Esempio n. 1
0
 /**
  * Parses the given token reader
  *
  * @param \vc\Data\Signature $signature The signature to use as a source
  * @param \vc\Tokens\Access $access The token access
  * @return \vc\Data\Property
  */
 public function parseProperty(\vc\Data\Signature $signature, \vc\Tokens\Access $access)
 {
     $prop = $signature->buildProperty();
     // Keep looking for modifier tokens until we reach the variable.
     // This isn't as strict as it could be about token order, but it greatly
     // simplifies the method to do it like this.
     do {
         $token = $access->findRequired(array(Token::T_STATIC, Token::T_VAR, Token::T_VARIABLE, Token::T_PUBLIC, Token::T_PROTECTED, Token::T_PRIVATE));
         if ($token->is(array(Token::T_PUBLIC, Token::T_PROTECTED, Token::T_PRIVATE))) {
             $prop->setVisibility(\vc\Data\Visibility::fromToken($token));
         } else {
             if ($token->is(Token::T_STATIC)) {
                 $prop->setStatic(TRUE);
             }
         }
     } while (!$token->is(Token::T_VARIABLE));
     $prop->setName($token->getContent());
     $token = $access->findRequired(array(Token::T_SEMICOLON, Token::T_EQUALS));
     // Look for any default value
     if ($token->is(Token::T_EQUALS)) {
         $prop->setValue($this->value->parseValue($access));
         $access->findRequired(array(Token::T_SEMICOLON));
     }
     return $prop;
 }