Nelmio\Alice\FixtureBuilder\Denormalizer\FlagParser\FlagParserRegistry::parse PHP Method

parse() public method

public parse ( string $element ) : FlagBag
$element string
return Nelmio\Alice\Definition\FlagBag
    public function parse(string $element) : FlagBag
    {
        foreach ($this->parsers as $parser) {
            if ($parser->canParse($element)) {
                return $parser->parse($element);
            }
        }
        throw FlagParserExceptionFactory::createForNoParserFoundForElement($element);
    }

Usage Example

Example #1
0
 /**
  * @expectedException \Nelmio\Alice\Throwable\Exception\FixtureBuilder\Denormalizer\FlagParser\FlagParserNotFoundException
  * @expectedExceptionMessage No suitable flag parser found to handle the element "string to parse".
  */
 public function testThrowsAnExceptionIfNotSuitableParserFound()
 {
     $parser = new FlagParserRegistry([]);
     $parser->parse('string to parse');
 }
FlagParserRegistry