summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/helpers/inflector_helper.rst
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-11-08 20:38:53 +0100
committerAndrey Andreev <narf@bofh.bg>2012-11-08 20:38:53 +0100
commit53b8ef524529e6ca9f32ad49d36c5140df84feb0 (patch)
tree383e10c617709699ca9e275797e405afad458816 /user_guide_src/source/helpers/inflector_helper.rst
parentf6d9a7cff222f868312a6d4ae4e4050616acb9a7 (diff)
Polish docs for HTML, Inflector, Language, Number, Path, Security and Smiley helpers
Also fixed a DB_cache bug introduced in previous commit and removed an unused parameter in a smiley helper
Diffstat (limited to 'user_guide_src/source/helpers/inflector_helper.rst')
-rw-r--r--user_guide_src/source/helpers/inflector_helper.rst82
1 files changed, 48 insertions, 34 deletions
diff --git a/user_guide_src/source/helpers/inflector_helper.rst b/user_guide_src/source/helpers/inflector_helper.rst
index cc46a1851..1f54b76c0 100644
--- a/user_guide_src/source/helpers/inflector_helper.rst
+++ b/user_guide_src/source/helpers/inflector_helper.rst
@@ -10,9 +10,7 @@ words to plural, singular, camel case, etc.
Loading this Helper
===================
-This helper is loaded using the following code
-
-::
+This helper is loaded using the following code::
$this->load->helper('inflector');
@@ -21,65 +19,81 @@ The following functions are available:
singular()
==========
-Changes a plural word to singular. Example
+.. php:function:: singular($str)
+
+ :param string $str: Input string
+ :returns: string
-::
+Changes a plural word to singular. Example::
- $word = "dogs";
- echo singular($word); // Returns "dog"
+ echo singular('dogs'); // Prints 'dog'
plural()
========
-Changes a singular word to plural. Example
-
-::
-
- $word = "dog";
- echo plural($word); // Returns "dogs"
+.. php:function:: plural($str)
-To force a word to end with "es" use a second "true" argument.
+ :param string $str: Input string
+ :returns: string
-::
+Changes a singular word to plural. Example::
- $word = "pass";
- echo plural($word, TRUE); // Returns "passes"
+ echo plural('dog'); // Prints 'dogs'
camelize()
==========
-Changes a string of words separated by spaces or underscores to camel
-case. Example
+.. php:function:: camelize($str)
+
+ :param string $str: Input string
+ :returns: string
-::
+Changes a string of words separated by spaces or underscores to camel
+case. Example::
- $word = "my_dog_spot";
- echo camelize($word); // Returns "myDogSpot"
+ echo camelize('my_dog_spot'); // Prints 'myDogSpot'
underscore()
============
-Takes multiple words separated by spaces and underscores them. Example
+.. php:function:: camelize($str)
-::
+ :param string $str: Input string
+ :returns: string
- $word = "my dog spot";
- echo underscore($word); // Returns "my_dog_spot"
+Takes multiple words separated by spaces and underscores them.
+Example::
+
+ echo underscore('my dog spot'); // Prints 'my_dog_spot'
humanize()
==========
+.. php:function:: camelize($str)
+
+ :param string $str: Input string
+ :param string $separator: Input separator
+ :returns: string
+
Takes multiple words separated by underscores and adds spaces between
-them. Each word is capitalized. Example
+them. Each word is capitalized.
+
+Example::
+
+ echo humanize('my_dog_spot'); // Prints 'My Dog Spot'
+
+To use dashes instead of underscores::
+
+ echo humanize('my-dog-spot', '-'); // Prints 'My Dog Spot'
-::
+is_countable()
+==============
- $word = "my_dog_spot";
- echo humanize($word); // Returns "My Dog Spot"
+.. php:function:: is_countable($word)
-To use dashes instead of underscores
+ :param string $word: Input string
+ :returns: bool
-::
+Checks if the given word has a plural version. Example::
- $word = "my-dog-spot";
- echo humanize($word, '-'); // Returns "My Dog Spot" \ No newline at end of file
+ is_countable('equipment'); // Returns FALSE \ No newline at end of file