/** * {@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()); } }
/** * {@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'); }
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('{^(?<threshold>[0-9.]+%?)\\? (?<trueValue>.+?)(?: : (?<falseValue>.+?))?$}'); }