[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/ -> Inflector.php (summary)

(no description)

File Size: 284 lines (10 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Inflector:: (11 methods):
  getInstance()
  createFactory()
  tableize()
  classify()
  camelize()
  ucwords()
  reset()
  rules()
  buildRuleset()
  pluralize()
  singularize()


Class: Inflector  - X-Ref


getInstance()   X-Ref


createFactory()   X-Ref
No description

tableize(string $word)   X-Ref
Converts a word into the format for a Doctrine table name. Converts 'ModelName' to 'model_name'.


classify(string $word)   X-Ref
Converts a word into the format for a Doctrine class name. Converts 'table_name' to 'TableName'.


camelize(string $word)   X-Ref
Camelizes a word. This uses the classify() method and turns the first character to lowercase.


ucwords(string $string, string $delimiters = " \n\t\r\0\x0B-")   X-Ref
Uppercases words with configurable delimiters between words.

Takes a string and capitalizes all of the words, like PHP's built-in
ucwords function. This extends that behavior, however, by allowing the
word delimiters to be configured, rather than only separating on
whitespace.

Here is an example:
<code>
<?php
$string = 'top-o-the-morning to all_of_you!';
echo \Doctrine\Common\Inflector\Inflector::ucwords($string);
// Top-O-The-Morning To All_of_you!

echo \Doctrine\Common\Inflector\Inflector::ucwords($string, '-_ ');
// Top-O-The-Morning To All_Of_You!
?>
</code>

param: string $string The string to operate on.
param: string $delimiters A list of word separators.
return: string The string with all delimiter-separated words capitalized.

reset()   X-Ref
Clears Inflectors inflected value caches, and resets the inflection
rules to the initial values.


rules(string $type, iterable $rules, bool $reset = false)   X-Ref
Adds custom inflection $rules, of either 'plural' or 'singular' $type.

### Usage:

{{{
Inflector::rules('plural', array('/^(inflect)or$/i' => '\1ables'));
Inflector::rules('plural', array(
'rules' => array('/^(inflect)ors$/i' => '\1ables'),
'uninflected' => array('dontinflectme'),
'irregular' => array('red' => 'redlings')
));
}}}

param: string  $type         The type of inflection, either 'plural' or 'singular'
param: array<string,mixed>|iterable<string,mixed> $rules An array of rules to be added.
param: boolean $reset        If true, will unset default inflections for all
return: void

buildRuleset(iterable $rules)   X-Ref

param: array<string,mixed>|iterable<string,mixed> $rules An array of rules to be added.

pluralize(string $word)   X-Ref
No description

singularize(string $word)   X-Ref
Returns a word in singular form.

param: string $word The word in plural form.
return: string The word in singular form.



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer