public PluralTranslation::__construct(array $values)
Constructs a new class instance.
array $values: An associative array with the following keys:
\InvalidArgumentException Thrown when the keys 'singular' or 'plural' are missing from the $values array.
public function __construct(array $values) { if (!isset($values['singular'])) { throw new \InvalidArgumentException('Missing "singular" value in the PluralTranslation annotation'); } if (!isset($values['plural'])) { throw new \InvalidArgumentException('Missing "plural" value in the PluralTranslation annotation'); } $this->singular = $values['singular']; $this->plural = $values['plural']; if (isset($values['context'])) { $this->context = $values['context']; } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Annotation!PluralTranslation.php/function/PluralTranslation::__construct/8.1.x