/** * Retrieve the name of the class starting from the T_CLASS token. * * @param DocBlox_Reflection_TokenIterator $tokens * * @return string */ protected function extractClassName(DocBlox_Reflection_TokenIterator $tokens) { // a class name can be a combination of a T_NAMESPACE and T_STRING $name = ''; $limits = array(';', '{', ','); /** @var DocBlox_Token $token */ while ($token = $tokens->next()) { if (in_array($token->content, $limits) || strlen(trim($name)) >= 1 && $token->type == T_WHITESPACE) { $tokens->previous(); break; } $name .= $token->content; } return trim($name); }