protected function processGenericInformation(DocBlox_TokenIterator $tokens) { $this->type = ucwords(strtolower(str_replace('_', ' ', substr($tokens->current()->getName(), 2)))); if ($token = $tokens->gotoNextByType(T_CONSTANT_ENCAPSED_STRING, 10, array(';'))) { $this->setName(trim($token->getContent(), '\'"')); } elseif ($token = $tokens->gotoNextByType(T_VARIABLE, 10, array(';'))) { $this->setName(trim($token->getContent(), '\'"')); } }
protected function processGenericInformation(DocBlox_TokenIterator $tokens) { $this->setName($tokens->gotoNextByType(T_STRING, 5, array('='))->getContent()); $this->setValue($this->findDefault($tokens)); parent::processGenericInformation($tokens); }
public function testGetTokenIdsOfParenthesisPair() { $this->object->seek(0); $this->object->gotoNextByType(T_FUNCTION, 0); $result = $this->object->getTokenIdsOfParenthesisPair(); $this->assertType('array', $result, 'Expected result to be an array'); $this->assertArrayHasKey(0, $result, 'Expected result to have a start element'); $this->assertArrayHasKey(1, $result, 'Expected result to have an end element'); $this->assertEquals(40, $result[0], 'Expected the first brace to be at token id 40'); $this->assertEquals(41, $result[1], 'Expected the closing brace to be at token id 41'); }
protected function processNamespace(DocBlox_TokenIterator $tokens) { // collect all namespace parts $namespace = array(); while($token = $tokens->gotoNextByType(T_STRING, 5, array(';', '{'))) { $namespace[] = $token->getContent(); } $namespace = implode('\\', $namespace); $this->active_namespace = $namespace; }