Esempio n. 1
0
 /**
  * {@inheritDoc}
  */
 public function process(ProcessableInterface $processable, array $variables)
 {
     $values = $processable->getValue();
     foreach ($values as $key => $value) {
         $values[$key] = $this->processor->process($value, $variables);
     }
     return $values;
 }
Esempio n. 2
0
 /**
  * {@inheritDoc}
  */
 public function process(ProcessableInterface $processable, array $variables)
 {
     $value = $processable->getValue();
     return preg_replace_callback('#<\\{([a-z0-9_\\.-]+)\\}>#i', function ($matches) {
         $key = $matches[1];
         if (!$this->parameters->has($key)) {
             throw new \UnexpectedValueException(sprintf('Parameter "%s" was not found', $key));
         }
         if (is_array($value = $this->parameters->get($key))) {
             return var_export($value, true);
         }
         return $value;
     }, $value);
 }
Esempio n. 3
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());
     }
 }
Esempio n. 4
0
 public function canProcess(ProcessableInterface $processable)
 {
     return is_string($processable->getValue()) && $processable->valueMatches('/^uppercase processor:(?<uppercaseMe>[a-z\\s]+?)$/');
 }
Esempio n. 5
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');
 }
Esempio n. 6
0
 /**
  * {@inheritDoc}
  */
 public function canProcess(ProcessableInterface $processable)
 {
     return is_string($processable->getValue()) && $processable->valueMatches('{^(?<threshold>[0-9.]+%?)\\? (?<trueValue>.+?)(?: : (?<falseValue>.+?))?$}');
 }
Esempio n. 7
0
 /**
  * {@inheritDoc}
  */
 public function process(ProcessableInterface $processable, array $variables)
 {
     $value = $processable->getValue();
     return preg_replace('{\\\\([@\\\\])}', '$1', $value);
 }
Esempio n. 8
0
 /**
  * {@inheritDoc}
  */
 public function process(ProcessableInterface $processable, array $variables)
 {
     $value = $processable->getValue();
     return str_replace('\\@', '@', $value);
 }