/** * {@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; }
/** * {@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); }
/** * {@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()); } }
public function canProcess(ProcessableInterface $processable) { return is_string($processable->getValue()) && $processable->valueMatches('/^uppercase processor:(?<uppercaseMe>[a-z\\s]+?)$/'); }
/** * {@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'); }
/** * {@inheritDoc} */ public function canProcess(ProcessableInterface $processable) { return is_string($processable->getValue()) && $processable->valueMatches('{^(?<threshold>[0-9.]+%?)\\? (?<trueValue>.+?)(?: : (?<falseValue>.+?))?$}'); }
/** * {@inheritDoc} */ public function process(ProcessableInterface $processable, array $variables) { $value = $processable->getValue(); return preg_replace('{\\\\([@\\\\])}', '$1', $value); }
/** * {@inheritDoc} */ public function process(ProcessableInterface $processable, array $variables) { $value = $processable->getValue(); return str_replace('\\@', '@', $value); }