Drupal 8  8.0.2
PluralFormula Class Reference
Inheritance diagram for PluralFormula:

Public Member Functions

 __construct (LanguageManagerInterface $language_manager, StateInterface $state)
 
 setPluralFormula ($langcode, $plural_count, array $formula)
 
 getNumberOfPlurals ($langcode=NULL)
 
 getFormula ($langcode)
 
 reset ()
 

Protected Member Functions

 loadFormulae ()
 

Protected Attributes

 $languageManager
 
 $state
 
 $formulae
 

Detailed Description

Manages the storage of plural formula per language in state.

See Also
::setHeader()

Constructor & Destructor Documentation

__construct ( LanguageManagerInterface  $language_manager,
StateInterface  $state 
)
Parameters
\Drupal\Core\Language\LanguageManagerInterface$language_manager
\Drupal\Core\State\StateInterface$state

References Drupal\languageManager(), and Drupal\state().

Here is the call graph for this function:

Member Function Documentation

getFormula (   $langcode)

{Gets the plural formula for a langcode.

Parameters
string$langcodeThe language code to get the formula for.
Returns
array An array of formulae.
}

Implements PluralFormulaInterface.

References PluralFormula\loadFormulae().

Here is the call graph for this function:

getNumberOfPlurals (   $langcode = NULL)

{Returns the number of plurals supported by a given language.

Parameters
null | string$langcode(optional) The language code. If not provided, the current language will be used.
Returns
int Number of plural variants supported by the given language.
}

Implements PluralFormulaInterface.

References Drupal\languageManager(), and PluralFormula\loadFormulae().

Here is the call graph for this function:

loadFormulae ( )
protected

Loads the formulae and stores them on the PluralFormula object if not set.

Returns
[]

References Drupal\state().

Referenced by PluralFormula\getFormula(), PluralFormula\getNumberOfPlurals(), and PluralFormula\setPluralFormula().

Here is the call graph for this function:

Here is the caller graph for this function:

reset ( )

{Resets the static formulae cache.

Returns
self The PluralFormula object.
}

Implements PluralFormulaInterface.

setPluralFormula (   $langcode,
  $plural_count,
array  $formula 
)

{

Parameters
string$langcodeThe language code to get the formula for.
int$plural_countThe number of plural forms.
array$formulaAn array of formulae.
Returns
self The PluralFormula object.
}

Implements PluralFormulaInterface.

References PluralFormula\loadFormulae(), and Drupal\state().

Here is the call graph for this function:


The documentation for this class was generated from the following file: