JOOMLA中国
  • Joomla中国首页
  • 社区
  • 教程
  • 应用市场
  • B计划
Joomla! Framework TM
  • Namespace
  • Class
  • Tree
  • Deprecated

Namespaces

  • Composer
    • Autoload
  • Joomla
    • Application
      • Cli
        • Output
          • Processor
      • Web
    • Data
    • DI
      • Exception
    • Event
    • Filter
    • Input
    • Ldap
    • Registry
      • Format
    • Session
      • Storage
    • String
    • Uri
    • Utilities
  • None
  • PasswordCompat
    • binary
  • PHP
  • Psr
    • Log
  • Symfony
    • Component
      • Yaml
        • Exception
    • Polyfill
      • Util

Classes

  • Inflector
  • Normalise
  • String
  • StringHelper

Class Inflector

Joomla Framework String Inflector Class

The Inflector transforms words

Namespace: Joomla\String
Since: 1.0
Located at vendor/joomla/string/src/Inflector.php

Methods summary

protected
# __construct( )

Protected constructor.

Protected constructor.

Since

1.0
public Joomla\String\Inflector
# addCountableRule( mixed $data )

Adds a countable word.

Adds a countable word.

Parameters

$data
mixed - $data A string or an array of strings to add.

Returns

Joomla\String\Inflector - Returns this object to support chaining.

Since

1.0
public Joomla\String\Inflector
# addWord( string $singular, string $plural = null )

Adds a specific singular-plural pair for a word.

Adds a specific singular-plural pair for a word.

Parameters

$singular
string - $singular The singular form of the word.
$plural
string - $plural The plural form of the word. If omitted, it is assumed the singular and plural are identical.

Returns

Joomla\String\Inflector - Returns this object to support chaining.

Since

1.0
public Joomla\String\Inflector
# addPluraliseRule( mixed $data )

Adds a pluralisation rule.

Adds a pluralisation rule.

Parameters

$data
mixed - $data A string or an array of regex rules to add.

Returns

Joomla\String\Inflector - Returns this object to support chaining.

Since

1.0
public Joomla\String\Inflector
# addSingulariseRule( mixed $data )

Adds a singularisation rule.

Adds a singularisation rule.

Parameters

$data
mixed - $data A string or an array of regex rules to add.

Returns

Joomla\String\Inflector - Returns this object to support chaining.

Since

1.0
public static Joomla\String\Inflector
# getInstance( boolean $new = false )

Gets an instance of the JStringInflector singleton.

Gets an instance of the JStringInflector singleton.

Parameters

$new
boolean - $new If true (default is false), returns a new instance regardless if one exists. This argument is mainly used for testing.

Returns

Joomla\String\Inflector

Since

1.0
public boolean
# isCountable( string $word )

Checks if a word is countable.

Checks if a word is countable.

Parameters

$word
string - $word The string input.

Returns

boolean - True if word is countable, false otherwise.

Since

1.0
public boolean
# isPlural( string $word )

Checks if a word is in a plural form.

Checks if a word is in a plural form.

Parameters

$word
string - $word The string input.

Returns

boolean - True if word is plural, false if not.

Since

1.0
public boolean
# isSingular( string $word )

Checks if a word is in a singular form.

Checks if a word is in a singular form.

Parameters

$word
string - $word The string input.

Returns

boolean - True if word is singular, false if not.

Since

1.0
public mixed
# toPlural( string $word )

Converts a word into its plural form.

Converts a word into its plural form.

Parameters

$word
string - $word The singular word to pluralise.

Returns

mixed - An inflected string, or false if no rule could be applied.

Since

1.0
public mixed
# toSingular( string $word )

Converts a word into its singular form.

Converts a word into its singular form.

Parameters

$word
string - $word The plural word to singularise.

Returns

mixed - An inflected string, or false if no rule could be applied.

Since

1.0

Magic methods summary

Joomla! Framework TM API documentation generated by ApiGen 2.8.0
Joomla!® and Joomla! Framework™ are trademarks of Open Source Matters, Inc. in the United States and other countries.