public function parse($string) { return preg_replace_callback('/\\{\\{\\s?(\\w+)\\s?\\}\\}/u', array($this, 'callFormatWithMatches'), $string); }
public function testParseReturnsStringWithTokensReplacedByFormatters() { $generator = new Generator(); $provider = new FooProvider(); $generator->addProvider($provider); $this->assertEquals('This is foobar a text with foobar', $generator->parse('This is {{fooFormatter}} a text with {{ fooFormatter }}')); }