Nelmio\Alice\FixtureBuilder\ExpressionLanguage\ParserInterface::parse PHP Method

parse() public method

Parses a value, e.g. 'foo' or '$username' to determine if is a regular value (like 'foo') or is a value that must be processed (like '$username'). If the value must be processed, it will be parsed to generate a value (a ValueInterface instance) ready for processing.
public parse ( string $value ) : Nelmio\Alice\Definition\ValueInterface | string | array
$value string
return Nelmio\Alice\Definition\ValueInterface | string | array
    public function parse(string $value);

Usage Example

コード例 #1
0
ファイル: StringMergerParser.php プロジェクト: nelmio/alice
 /**
  * Uses the decorated parser to parse the value and then walk through the list of values to merge two successive
  * strings.
  *
  * {@inheritdoc}
  */
 public function parse(string $value)
 {
     $parsedValue = $this->parser->parse($value);
     if (false === $parsedValue instanceof ListValue) {
         return $parsedValue;
     }
     $mergedValues = array_reduce($parsedValue->getValue(), [$this, 'mergeStrings'], $initial = []);
     return 1 === count($mergedValues) ? $mergedValues[0] : new ListValue($mergedValues);
 }
All Usage Examples Of Nelmio\Alice\FixtureBuilder\ExpressionLanguage\ParserInterface::parse
ParserInterface