src/Text.php
private static function runInflection($text, $rules)
    {
        if(in_array($text, self::$noPlurals)) {
            return $text;
        }
        foreach($rules as $rule) {
            if(preg_match($rule[0], $text, $matches)) {
                return substr($text, 0, strlen($text) - strlen($matches['remove'] ?? '')) . $rule[1];
            }
        }
    }
private static function runInflection($text, $rules)
    {
        if(in_array($text, self::$noPlurals)) {
            return $text;
        }
        foreach($rules as $rule) {
            if(preg_match($rule[0], $text, $matches)) {
                return substr($text, 0, strlen($text) - strlen($matches['remove'] ?? '')) . $rule[1];
            }
        }
    }
private static function runInflection ( $ text , $ rules ) { if ( in_array ( $ text , self :: $ noPlurals ) ) { return $ text ; } foreach ( $ rules as $ rule ) { if ( preg_match ( $ rule [ 0 ] , $ text , $ matches ) ) { return substr ( $ text , 0 , strlen ( $ text ) - strlen ( $ matches [ 'remove' ] ?? '' ) ) . $ rule [ 1 ] ; } } }
Run through the rules and generate a text transformation.

@param string $text
@param array $rules
@return string|null
Run through the rules and generate a text transformation .