phplinter\Tokenizer::token_name PHP Method

token_name() public static method

----------------------------------------------------------------------+
public static token_name ( $token ) : String
$token int
return String ----------------------------------------------------------------------+
    public static function token_name($token)
    {
        switch ($token) {
            case T_IGNORE:
                return 'T_IGNORE';
            case T_NEWLINE:
                return 'T_NEWLINE';
            case T_CURLY_CLOSE:
                return 'T_CURLY_CLOSE';
            case T_SQUARE_OPEN:
                return 'T_SQUARE_OPEN';
            case T_SQUARE_CLOSE:
                return 'T_SQUARE_CLOSE';
            case T_PARENTHESIS_OPEN:
                return 'T_PARENTHESIS_OPEN';
            case T_PARENTHESIS_CLOSE:
                return 'T_PARENTHESIS_CLOSE';
            case T_STR_CONCAT:
                return 'T_STR_CONCAT';
            case T_SEMICOLON:
                return 'T_SEMICOLON';
            case T_COLON:
                return 'T_COLON';
            case T_EQUALS:
                return 'T_EQUALS';
            case T_THEN:
                return 'T_THEN';
            case T_METHOD:
                return 'T_METHOD';
            case T_ANON_FUNCTION:
                return 'T_ANON_FUNCTION';
            case T_TRUE:
                return 'T_TRUE';
            case T_FALSE:
                return 'T_FALSE';
            case T_NULL:
                return 'T_NULL';
            case T_SELF:
                return 'T_SELF';
            case T_PARENT:
                return 'T_PARENT';
            case T_OPEN_SCOPE:
                return 'T_OPEN_SCOPE';
            case T_CLOSE_SCOPE:
                return 'T_CLOSE_SCOPE';
            default:
                return token_name($token);
        }
    }

Usage Example

Example #1
0
 /**
 ----------------------------------------------------------------------+
 * @desc 	Harvest from node
 * @param	Mixed
 * @return   Array
 ----------------------------------------------------------------------+
 */
 protected function _extract($node)
 {
     if (!$node) {
         return null;
     }
     if (is_array($node)) {
         $out = array();
         foreach ($node as $_) {
             $out[] = $this->_extract($_);
         }
         return $out;
     }
     if ($node->type === T_FILE) {
         $this->namespace = null;
     }
     $out = array('name' => $node->name, 'type' => \phplinter\Tokenizer::token_name($node->type), 'comment' => $node->comments, 'static' => $node->static, 'abstract' => $node->abstract, 'visibility' => $node->visibility, 'namespace' => $this->namespace, 'extends' => $node->extends, 'implements' => $node->implements, 'arguments' => $node->arguments, 'constants' => $node->constants, 'start_line' => $node->start_line, 'end_line' => $node->end_line, 'score' => SCORE_FULL + $this->penaltys[$node->file], 'nodes' => $this->_extract($node->nodes), 'file' => $node->file);
     if ($node->namespace) {
         $this->namespace = $node->namespace;
         $out['namespace'] = $this->namespace;
     }
     return $out;
 }
All Usage Examples Of phplinter\Tokenizer::token_name