src/text/EnglishPluralizer.php
public function getSingularForm($root) {
		$singularForm = $root;

		if (!is_string($root)) {
			throw new \InvalidArgumentException('The pluralizer expects a string.');
		}

		if (!in_array(strtolower($root), $this->uncountable)) {
			if (null !== $replacement = $this->checkIrregularForm($root, array_flip($this->irregular))) {
				$singularForm = $replacement;
			} elseif (null !== $replacement = $this->checkIrregularSuffix($root, $this->singular)) {
				$singularForm = $replacement;
			} elseif (!$this->isSingular($root)) {
				// fallback to naive singularization
				return substr($root, 0, -1);
			}
		}

		return $singularForm;
	}
public function getSingularForm($root) {
		$singularForm = $root;

		if (!is_string($root)) {
			throw new \InvalidArgumentException('The pluralizer expects a string.');
		}

		if (!in_array(strtolower($root), $this->uncountable)) {
			if (null !== $replacement = $this->checkIrregularForm($root, array_flip($this->irregular))) {
				$singularForm = $replacement;
			} elseif (null !== $replacement = $this->checkIrregularSuffix($root, $this->singular)) {
				$singularForm = $replacement;
			} elseif (!$this->isSingular($root)) {
				// fallback to naive singularization
				return substr($root, 0, -1);
			}
		}

		return $singularForm;
	}
public function getSingularForm ( $ root ) { $ singularForm = $ root ; if ( ! is_string ( $ root ) ) { throw new \ InvalidArgumentException ( 'The pluralizer expects a string.' ) ; } if ( ! in_array ( strtolower ( $ root ) , $ this -> uncountable ) ) { if ( null !== $ replacement = $ this -> checkIrregularForm ( $ root , array_flip ( $ this -> irregular ) ) ) { $ singularForm = $ replacement ; } elseif ( null !== $ replacement = $ this -> checkIrregularSuffix ( $ root , $ this -> singular ) ) { $ singularForm = $ replacement ; } elseif ( ! $ this -> isSingular ( $ root ) ) { // fallback to naive singularization return substr ( $ root , 0 , - 1 ) ; } } return $ singularForm ; }
Generate a singular name based on the passed in root.

@param  string $root The root that needs to be pluralized (e.g. Author)
@return string The singular form of $root (e.g. Authors).
@throws \InvalidArgumentException If the parameter is not a string.
Generate a singular name based on the passed in root .