private function DocParser::Values

Values ::= Array | Value {"," Value}*

Return value

array

1 call to DocParser::Values()
DocParser::Annotation in drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocParser.php
Annotation ::= "@" AnnotationName ["(" [Values] ")"] AnnotationName ::= QualifiedName | SimpleName QualifiedName ::= NameSpacePart "\" {NameSpacePart "\"}* SimpleName NameSpacePart ::= identifier…

File

drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocParser.php, line 709

Class

DocParser
A parser for docblock annotations.

Namespace

Doctrine\Common\Annotations

Code

private function Values() {
  $values = array();

  // Handle the case of a single array as value, i.e. @Foo({....})
  if ($this->lexer
    ->isNextToken(DocLexer::T_OPEN_CURLY_BRACES)) {
    $values['value'] = $this
      ->Value();
    return $values;
  }
  $values[] = $this
    ->Value();
  while ($this->lexer
    ->isNextToken(DocLexer::T_COMMA)) {
    $this
      ->match(DocLexer::T_COMMA);
    $token = $this->lexer->lookahead;
    $value = $this
      ->Value();
    if (!is_object($value) && !is_array($value)) {
      $this
        ->syntaxError('Value', $token);
    }
    $values[] = $value;
  }
  foreach ($values as $k => $value) {
    if (is_object($value) && $value instanceof \stdClass) {
      $values[$value->name] = $value->value;
    }
    else {
      if (!isset($values['value'])) {
        $values['value'] = $value;
      }
      else {
        if (!is_array($values['value'])) {
          $values['value'] = array(
            $values['value'],
          );
        }
        $values['value'][] = $value;
      }
    }
    unset($values[$k]);
  }
  return $values;
}