lib/Inflector/Methods.php
private static function apply_inflections($word, $rules){
		$result = $word;
		preg_match('/\b\w+\Z/', strtolower($result), $matches);
		if( empty($word) || array_search($matches[0], static::inflections()->uncountables) !== false ){
			return $result;
		}else{
			foreach($rules as $rule_replacement){
				list($rule, $replacement) = $rule_replacement;
				$result = preg_replace($rule, $replacement, $result, -1, $count);
				if($count){
					break;
				}
			}
			return $result;
		}
	}
private static function apply_inflections($word, $rules){
		$result = $word;
		preg_match('/\b\w+\Z/', strtolower($result), $matches);
		if( empty($word) || array_search($matches[0], static::inflections()->uncountables) !== false ){
			return $result;
		}else{
			foreach($rules as $rule_replacement){
				list($rule, $replacement) = $rule_replacement;
				$result = preg_replace($rule, $replacement, $result, -1, $count);
				if($count){
					break;
				}
			}
			return $result;
		}
	}
private static function apply_inflections ( $ word , $ rules ) { $ result = $ word ; preg_match ( '/\b\w+\Z/' , strtolower ( $ result ) , $ matches ) ; if ( empty ( $ word ) || array_search ( $ matches [ 0 ] , static :: inflections ( ) -> uncountables ) !== false ) { return $ result ; } else { foreach ( $ rules as $ rule_replacement ) { list ( $ rule , $ replacement ) = $ rule_replacement ; $ result = preg_replace ( $ rule , $ replacement , $ result , - 1 , $ count ) ; if ( $ count ) { break ; } } return $ result ; } }
Applies inflection rules for +singularize+ and +pluralize+.

Examples:
apply_inflections("post", inflections()->plurals) # => "posts"
apply_inflections("posts", inflections()->singulars) # => "post"

@param string $word
@param array $rules
@return string inflected $word
@author Koen Punt
Applies inflection rules for + singularize + and + pluralize + .