Nextras\Orm\Entity\Reflection\ModifierParser::parse PHP Метод

parse() публичный Метод

public parse ( string $string, ReflectionClass $reflectionClass ) : array
$string string
$reflectionClass ReflectionClass
Результат array
    public function parse($string, ReflectionClass $reflectionClass)
    {
        $tokens = $this->lex($string, $reflectionClass);
        $iterator = new TokenIterator($tokens);
        return [$name = $this->processName($iterator), $this->processArgs($iterator, $name, false)];
    }

Usage Example

Пример #1
0
 protected function parseAnnotationValue(PropertyMetadata $property, $propertyComment)
 {
     if (!$propertyComment) {
         return;
     }
     $matches = $this->modifierParser->matchModifiers($propertyComment);
     foreach ($matches as $macroContent) {
         try {
             $args = $this->modifierParser->parse($macroContent, $this->currentReflection);
         } catch (InvalidModifierDefinitionException $e) {
             throw new InvalidModifierDefinitionException("Invalid modifier definition for {$this->currentReflection->name}::\${$property->name} property.", 0, $e);
         }
         $this->processPropertyModifier($property, $args[0], $args[1]);
     }
 }