Gush\Template\Pats\Pats::get PHP Méthode

get() public static méthode

public static get ( $name )
    public static function get($name)
    {
        $pats = self::getPats();
        if (!isset($pats[$name])) {
            throw new \InvalidArgumentException(sprintf('Pat named "%s" doesn\'t exist', $name));
        }
        return $pats[$name];
    }

Usage Example

Exemple #1
0
 private function renderPat(array $placeHolders, $pat)
 {
     $resultString = Pats::get($pat);
     foreach ($placeHolders as $placeholder => $value) {
         $resultString = str_replace('{{ ' . $placeholder . ' }}', $value, $resultString);
     }
     return $resultString;
 }