public static
ICanBoogie\Inflector
|
#
get( string $locale = self::DEFAULT_LOCALE )
Returns an inflector for the specified locale.
Returns an inflector for the specified locale.
Note: Inflectors are shared for the same locale. If you need to alter an inflector you
MUST clone it first.
Parameters
Returns
|
protected
|
|
public
|
#
__get( string $property )
Returns the ICanBoogie\Inflector::$inflections property.
Parameters
Throws
PropertyNotDefined in attempt to read an inaccessible property. If the PropertyNotDefined
class is not available a \InvalidArgumentException is thrown instead.
|
public
|
|
public
string
|
#
pluralize( string $word )
Returns the plural form of the word in the string.
Returns the plural form of the word in the string.
$this->pluralize('post');
$this->pluralize('children');
$this->pluralize('sheep');
$this->pluralize('words');
$this->pluralize('CamelChild');
Parameters
Returns
string
|
public
string
|
#
singularize( string $word )
The reverse of pluralize, returns the singular form of a word in a string.
The reverse of pluralize, returns the singular form of a word in a string.
$this->singularize('posts');
$this->singularize('childred');
$this->singularize('sheep');
$this->singularize('word');
$this->singularize('CamelChildren');
Parameters
Returns
string
|
public
string
|
#
camelize( string $term, boolean $downcase_first_letter = self::UPCASE_FIRST_LETTER )
By default, camelize converts strings to UpperCamelCase.
By default, camelize converts strings to UpperCamelCase.
camelize will also convert "/" to "\" which is useful for converting paths to
namespaces.
$this->camelize('active_model');
$this->camelize('active_model', true);
$this->camelize('active_model/errors');
$this->camelize('active_model/errors', true);
As a rule of thumb you can think of camelize as the inverse of underscore,
though there are cases where that does not hold:
$this->camelize($this->underscore('SSLError'));
Parameters
Returns
string
|
public
string
|
#
underscore( string $camel_cased_word )
Makes an underscored, lowercase form from the expression in the string.
Makes an underscored, lowercase form from the expression in the string.
Changes "\" to "/" to convert namespaces to paths.
$this->underscore('ActiveModel');
$this->underscore('ActiveModel\Errors');
As a rule of thumb you can think of underscore as the inverse of camelize(),
though there are cases where that does not hold:
$this->camelize($this->underscore('SSLError'));
Parameters
Returns
string
|
public
string
|
#
humanize( string $lower_case_and_underscored_word )
Capitalizes the first word and turns underscores into spaces and strips a trailing "_id",
if any. Like titleize(), this is meant for creating pretty output.
Capitalizes the first word and turns underscores into spaces and strips a trailing "_id",
if any. Like titleize(), this is meant for creating pretty output.
$this->humanize('employee_salary');
$this->humanize('author_id');
Parameters
- $lower_case_and_underscored_word
Returns
string
|
public
string
|
#
titleize( string $str )
Capitalizes all the words and replaces some characters in the string to create a nicer
looking title. titleize() is meant for creating pretty output. It is not used in
the Rails internals.
Capitalizes all the words and replaces some characters in the string to create a nicer
looking title. titleize() is meant for creating pretty output. It is not used in
the Rails internals.
$this->titleize('man from the boondocks');
$this->titleize('x-men: the last stand');
$this->titleize('TheManWithoutAPast');
$this->titleize('raiders_of_the_lost_ark');
Parameters
Returns
string
|
public
string
|
#
dasherize( string $underscored_word )
Replaces underscores with dashes in the string.
Replaces underscores with dashes in the string.
$this->dasherize('puni_puni');
Parameters
Returns
string
|
public
string
|
#
hyphenate( string $str )
Makes an hyphenated, lowercase form from the expression in the string.
Makes an hyphenated, lowercase form from the expression in the string.
This is a combination of underscore and ICanBoogie\Inflector::dasherize() .
Parameters
Returns
string
|
public
string
|
#
ordinal( integer $number )
Returns the suffix that should be added to a number to denote the position in an ordered
sequence such as 1st, 2nd, 3rd, 4th.
Returns the suffix that should be added to a number to denote the position in an ordered
sequence such as 1st, 2nd, 3rd, 4th.
$this->ordinal(1);
$this->ordinal(2);
$this->ordinal(1002);
$this->ordinal(1003);
$this->ordinal(-11);
$this->ordinal(-1021);
Parameters
Returns
string
|
public
string
|
#
ordinalize( integer $number )
Turns a number into an ordinal string used to denote the position in an ordered sequence
such as 1st, 2nd, 3rd, 4th.
Turns a number into an ordinal string used to denote the position in an ordered sequence
such as 1st, 2nd, 3rd, 4th.
$this->ordinalize(1);
$this->ordinalize(2);
$this->ordinalize(1002);
$this->ordinalize(1003);
$this->ordinalize(-11);
$this->ordinalize(-1021);
Parameters
Returns
string
|