Faker\Provider\fr_FR\Company::isCatchPhraseValid PHP Méthode

isCatchPhraseValid() protected static méthode

Validates a french catch phrase.
protected static isCatchPhraseValid ( string $catchPhrase ) : boolean
$catchPhrase string The catch phrase to validate.
Résultat boolean (true if valid, false otherwise)
    protected static function isCatchPhraseValid($catchPhrase)
    {
        foreach (static::$wordsWhichShouldNotAppearTwice as $word) {
            // Fastest way to check if a piece of word does not appear twice.
            $beginPos = strpos($catchPhrase, $word);
            $endPos = strrpos($catchPhrase, $word);
            if ($beginPos !== false && $beginPos != $endPos) {
                return false;
            }
        }
        return true;
    }

Usage Example

Exemple #1
0
 public function testCatchPhraseValidationReturnsTrue()
 {
     $isCatchPhraseValid = Company::isCatchPhraseValid('La sécurité de rouler en toute simplicité');
     $this->assertTrue($isCatchPhraseValid);
 }
All Usage Examples Of Faker\Provider\fr_FR\Company::isCatchPhraseValid