Ejemplo n.º 1
0
 /**
  * {@inheritDoc}
  */
 public function process(ProcessableInterface $processable, array $variables)
 {
     $fakerRegex = '<(?:(?<locale>[a-z]+(?:_[a-z]+)?):)?(?<name>[a-z0-9_]+?)?\\((?<args>(?:[^)]*|\\)(?!>))*)\\)>';
     if ($processable->valueMatches('#^' . $fakerRegex . '$#i')) {
         return $this->replacePlaceholder($processable->getMatches(), $variables);
     } else {
         // format placeholders inline
         return preg_replace_callback('#' . $fakerRegex . '#i', function ($matches) use($variables) {
             return $this->replacePlaceholder($matches, $variables);
         }, $processable->getValue());
     }
 }
Ejemplo n.º 2
0
 /**
  * {@inheritDoc}
  */
 public function canProcess(ProcessableInterface $processable)
 {
     return is_string($processable->getValue()) && $processable->valueMatches('{^(?:(?<multi>\\d+)x )?@(?<reference>[a-z0-9_.*-]+)(?<sequence>\\{(?P<from>\\d+)\\.\\.(?P<to>\\d+)\\})?(?:\\->(?<property>[a-z0-9_-]+))?$}i');
 }
Ejemplo n.º 3
0
 public function canProcess(ProcessableInterface $processable)
 {
     return is_string($processable->getValue()) && $processable->valueMatches('/^uppercase processor:(?<uppercaseMe>[a-z\\s]+?)$/');
 }
Ejemplo n.º 4
0
 /**
  * {@inheritDoc}
  */
 public function canProcess(ProcessableInterface $processable)
 {
     return is_string($processable->getValue()) && $processable->valueMatches('{^(?<threshold>[0-9.]+%?)\\? (?<trueValue>.+?)(?: : (?<falseValue>.+?))?$}');
 }