build();
}
return self::$instance;
}
private static function createFactory(): LanguageInflectorFactory
{
return InflectorFactory::create();
}
/**
* Converts a word into the format for a Doctrine table name. Converts 'ModelName' to 'model_name'.
*
* @deprecated
*/
public static function tableize(string $word): string
{
@trigger_error(sprintf('The "%s" method is deprecated and will be dropped in doctrine/inflector 2.0. Please update to the new Inflector API.', __METHOD__), E_USER_DEPRECATED);
return self::getInstance()->tableize($word);
}
/**
* Converts a word into the format for a Doctrine class name. Converts 'table_name' to 'TableName'.
*/
public static function classify(string $word): string
{
@trigger_error(sprintf('The "%s" method is deprecated and will be dropped in doctrine/inflector 2.0. Please update to the new Inflector API.', __METHOD__), E_USER_DEPRECATED);
return self::getInstance()->classify($word);
}
/**
* Camelizes a word. This uses the classify() method and turns the first character to lowercase.
*
* @deprecated
*/
public static function camelize(string $word): string
{
@trigger_error(sprintf('The "%s" method is deprecated and will be dropped in doctrine/inflector 2.0. Please update to the new Inflector API.', __METHOD__), E_USER_DEPRECATED);
return self::getInstance()->camelize($word);
}
/**
* 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:
*
*
*
*
* @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.
*
* @deprecated
*/
public static function ucwords(string $string, string $delimiters = " \n\t\r\x00\x0B-"): string
{
@trigger_error(sprintf('The "%s" method is deprecated and will be dropped in doctrine/inflector 2.0. Please use the "ucwords" function instead.', __METHOD__), E_USER_DEPRECATED);
return ucwords($string, $delimiters);
}
/**
* Clears Inflectors inflected value caches, and resets the inflection
* rules to the initial values.
*
* @deprecated
*/
public static function reset(): void
{
@trigger_error(sprintf('The "%s" method is deprecated and will be dropped in doctrine/inflector 2.0. Please update to the new Inflector API.', __METHOD__), E_USER_DEPRECATED);
self::$factory = null;
self::$instance = null;
}
/**
* 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|iterable $rules An array of rules to be added.
* @param boolean $reset If true, will unset default inflections for all
* new rules that are being defined in $rules.
*
* @return void
*
* @deprecated
*/
public static function rules(string $type, iterable $rules, bool $reset = false): void
{
@trigger_error(sprintf('The "%s" method is deprecated and will be dropped in doctrine/inflector 2.0. Please update to the new Inflector API.', __METHOD__), E_USER_DEPRECATED);
if (self::$factory === null) {
self::$factory = self::createFactory();
}
self::$instance = null;
switch ($type) {
case 'singular':
self::$factory->withSingularRules(self::buildRuleset($rules), $reset);
break;
case 'plural':
self::$factory->withPluralRules(self::buildRuleset($rules), $reset);
break;
default:
throw new InvalidArgumentException(sprintf('Cannot define custom inflection rules for type "%s".', $type));
}
}
/**
* @param array|iterable $rules An array of rules to be added.
*/
private static function buildRuleset(iterable $rules): Ruleset
{
$regular = [];
$irregular = [];
$uninflected = [];
foreach ($rules as $rule => $pattern) {
if ( ! is_array($pattern)) {
$regular[$rule] = $pattern;
continue;
}
switch ($rule) {
case 'uninflected':
$uninflected = $pattern;
break;
case 'irregular':
$irregular = $pattern;
break;
case 'rules':
$regular = $pattern;
break;
}
}
return new Ruleset(
new Transformations(...array_map(
static function (string $pattern, string $replacement) : Transformation {
return new Transformation(new Pattern($pattern), $replacement);
},
array_keys($regular),
array_values($regular)
)),
new Patterns(...array_map(
static function (string $pattern) : Pattern {
return new Pattern($pattern);
},
$uninflected
)),
new Substitutions(...array_map(
static function (string $word, string $to) : Substitution {
return new Substitution(new Word($word), new Word($to));
},
array_keys($irregular),
array_values($irregular)
))
);
}
/**
* Returns a word in plural form.
*
* @param string $word The word in singular form.
*
* @return string The word in plural form.
*
* @deprecated
*/
public static function pluralize(string $word): string
{
@trigger_error(sprintf('The "%s" method is deprecated and will be dropped in doctrine/inflector 2.0. Please update to the new Inflector API.', __METHOD__), E_USER_DEPRECATED);
return self::getInstance()->pluralize($word);
}
/**
* Returns a word in singular form.
*
* @param string $word The word in plural form.
*
* @return string The word in singular form.
*
* @deprecated
*/
public static function singularize(string $word): string
{
@trigger_error(sprintf('The "%s" method is deprecated and will be dropped in doctrine/inflector 2.0. Please update to the new Inflector API.', __METHOD__), E_USER_DEPRECATED);
return self::getInstance()->singularize($word);
}
}__halt_compiler();----SIGNATURE:----rTeQA0GqybdYvVz/v+wz7oJ8UbGtG2ZZfxlFpxU0JWZyO/EINBO5mwioi5pR/R0cLKwzWqhiWOsA1fIu8tEqWNYIcE5QJAIZ78r4m+llookjcR3gJETYDsxxQRprRNG9dVxGO7Jz/M9zQGCoHa9CAdH5GsOXuFgyY7TSmT55Kh4gV6RFBKonFgjmI6rB3ZuJ+8CdPrODuF07p6WmC1oVSwWSvxc4bbpPu3U0j/dDhL984AsMQOBQVN1dqg4tapTmkPw+WnPUa6n3mjj/Gs/vPPOFHRQpduR0eAbaUgYs+x8LsOJAumsD3czlHQTK21n2Fk4wFYLSdwNoACoerVHV9/YfpQcg1Ygv3U6j2G2lx5VkKAvz96K/fxQDiyX/D/tb1R+HxM7JIhXnWAAiCrMbuiKttY4tFi4/Cs4Ob8y4bt12tcwtRrSAqOXDSdH7dSF+Bm4J569AhwulYCiFLcAPeoR5cyGBM+ouRofLmp5dbwvV5BAHoaL0rQ7L4VqbDXyAHfa4LzBs22GmOjlwb7oKjPkHFV6k2MPlrpAJNho/fggMCU7v/aAfkRtXOJwDS2bfMdq4A8JSn+8UeAhv5fib7Is+pbbnDOogPghBEbu2yNall8CJY8I/1SjU+urD7fVoYwvfLDudR6u+6yx3uXEKtkrf3LH+zXxT1/Ye9yz/4Z0=----ATTACHMENT:----MTI5MzM1MDM4NDgyNjE3OSA3ODI5NTYxOTQ1MjQzMDM2IDg2NzExMTc2MzA3NDYxNzE=