private function add()
    {
        // skip if it's a key
        if ((null !== ($check = $this->tokens->getToken($this->tokens->key() + 1)))
            && ((DocLexer::T_COLON === $check[0])
                || (DocLexer::T_EQUALS === $check[0]))) {
            return;
        }

        $token = $this->tokens->current();
        $value = $this->result->createElement('value');

        if (null !== ($key = $this->key())) {
            $value->setAttribute('key', $key);
        }

        $this->current->appendChild($value);

        $text = null;
        $type = null;

        switch ($token[0]) {
            case DocLexer::T_FALSE:
                $text = '0';
                $type = 'boolean';

                break;
            case DocLexer::T_FLOAT:
                $text = $token[1];
                $type = 'float';

                break;
            case DocLexer::T_IDENTIFIER:
                $text = $token[1];
                $type = 'constant';

                break;
            case DocLexer::T_INTEGER:
                $text = $token[1];
                $type = 'integer';

                break;
            case DocLexer::T_NULL:
                $type = 'null';

                break;
            case DocLexer::T_STRING:
                $text = $token[1];
                $type = 'string';

                break;
            case DocLexer::T_TRUE:
                $text = '1';
                $type = 'boolean';

                break;
        }

        $value->setAttribute('type', $type);

        if (null !== $text) {
            $value->appendChild(new DOMText($text));
        }
    }
private function add()
    {
        // skip if it's a key
        if ((null !== ($check = $this->tokens->getToken($this->tokens->key() + 1)))
            && ((DocLexer::T_COLON === $check[0])
                || (DocLexer::T_EQUALS === $check[0]))) {
            return;
        }

        $token = $this->tokens->current();
        $value = $this->result->createElement('value');

        if (null !== ($key = $this->key())) {
            $value->setAttribute('key', $key);
        }

        $this->current->appendChild($value);

        $text = null;
        $type = null;

        switch ($token[0]) {
            case DocLexer::T_FALSE:
                $text = '0';
                $type = 'boolean';

                break;
            case DocLexer::T_FLOAT:
                $text = $token[1];
                $type = 'float';

                break;
            case DocLexer::T_IDENTIFIER:
                $text = $token[1];
                $type = 'constant';

                break;
            case DocLexer::T_INTEGER:
                $text = $token[1];
                $type = 'integer';

                break;
            case DocLexer::T_NULL:
                $type = 'null';

                break;
            case DocLexer::T_STRING:
                $text = $token[1];
                $type = 'string';

                break;
            case DocLexer::T_TRUE:
                $text = '1';
                $type = 'boolean';

                break;
        }

        $value->setAttribute('type', $type);

        if (null !== $text) {
            $value->appendChild(new DOMText($text));
        }
    }
private function add ( ) { // skip if it's a key if ( ( null !== ( $ check = $ this -> tokens -> getToken ( $ this -> tokens -> key ( ) + 1 ) ) ) && ( ( DocLexer :: T_COLON === $ check [ 0 ] ) || ( DocLexer :: T_EQUALS === $ check [ 0 ] ) ) ) { return ; } $ token = $ this -> tokens -> current ( ) ; $ value = $ this -> result -> createElement ( 'value' ) ; if ( null !== ( $ key = $ this -> key ( ) ) ) { $ value -> setAttribute ( 'key' , $ key ) ; } $ this -> current -> appendChild ( $ value ) ; $ text = null ; $ type = null ; switch ( $ token [ 0 ] ) { case DocLexer :: T_FALSE : $ text = '0' ; $ type = 'boolean' ; break ; case DocLexer :: T_FLOAT : $ text = $ token [ 1 ] ; $ type = 'float' ; break ; case DocLexer :: T_IDENTIFIER : $ text = $ token [ 1 ] ; $ type = 'constant' ; break ; case DocLexer :: T_INTEGER : $ text = $ token [ 1 ] ; $ type = 'integer' ; break ; case DocLexer :: T_NULL : $ type = 'null' ; break ; case DocLexer :: T_STRING : $ text = $ token [ 1 ] ; $ type = 'string' ; break ; case DocLexer :: T_TRUE : $ text = '1' ; $ type = 'boolean' ; break ; } $ value -> setAttribute ( 'type' , $ type ) ; if ( null !== $ text ) { $ value -> appendChild ( new DOMText ( $ text ) ) ; } }
Adds a value to the current list or annotation.
Adds a value to the current list or annotation .