You are here

private function DocParser::Arrayx in Service Container 7

Same name and namespace in other branches
  1. 7.2 modules/providers/service_container_annotation_discovery/lib/Doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php \Doctrine\Common\Annotations\DocParser::Arrayx()

Array ::= "{" ArrayEntry {"," ArrayEntry}* [","] "}"

Return value

array

1 call to DocParser::Arrayx()
DocParser::PlainValue in modules/providers/service_container_annotation_discovery/lib/Doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php
PlainValue ::= integer | string | float | boolean | Array | Annotation

File

modules/providers/service_container_annotation_discovery/lib/Doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php, line 1069

Class

DocParser
A parser for docblock annotations.

Namespace

Doctrine\Common\Annotations

Code

private function Arrayx() {
  $array = $values = array();
  $this
    ->match(DocLexer::T_OPEN_CURLY_BRACES);

  // If the array is empty, stop parsing and return.
  if ($this->lexer
    ->isNextToken(DocLexer::T_CLOSE_CURLY_BRACES)) {
    $this
      ->match(DocLexer::T_CLOSE_CURLY_BRACES);
    return $array;
  }
  $values[] = $this
    ->ArrayEntry();
  while ($this->lexer
    ->isNextToken(DocLexer::T_COMMA)) {
    $this
      ->match(DocLexer::T_COMMA);

    // optional trailing comma
    if ($this->lexer
      ->isNextToken(DocLexer::T_CLOSE_CURLY_BRACES)) {
      break;
    }
    $values[] = $this
      ->ArrayEntry();
  }
  $this
    ->match(DocLexer::T_CLOSE_CURLY_BRACES);
  foreach ($values as $value) {
    list($key, $val) = $value;
    if ($key !== null) {
      $array[$key] = $val;
    }
    else {
      $array[] = $val;
    }
  }
  return $array;
}