Kahlan\Jit\TokenStream::getValue PHP Method

getValue() public method

Returns the current token value.
public getValue ( integer $index = null ) : string | null
$index integer Token position, if none given, consider the current iteration position.
return string | null
    public function getValue($index = null)
    {
        return $this->_getToken($index, 1);
    }

Usage Example

Beispiel #1
0
     it("bails out nicely if there's no further tags", function () {
         $stream = new TokenStream(['source' => '']);
         $actual = $stream->nextMatchingBracket();
         expect($actual)->toBe(null);
     });
     it("bails out nicely if the current tags is not an open tags", function () {
         $stream = new TokenStream(['source' => '<?php ?>']);
         $actual = $stream->nextMatchingBracket();
         expect($actual)->toBe(null);
     });
     it("cancels the lookup if there's no closing tags", function () {
         $stream = new TokenStream(['source' => '<?php { { } ?>']);
         $stream->next('{');
         $actual = $stream->nextMatchingBracket();
         expect($actual)->toBe(null);
         expect($stream->getValue())->toBe('{');
     });
 });
 describe("->prev()", function () {
     it("moves prev", function () {
         $key = $this->stream->key();
         $this->stream->next();
         $this->stream->prev();
         expect($key)->not->toBe($this->stream->current());
     });
     it("gets the previous token value", function () {
         $this->stream->seek(1);
         $actual = $this->stream->prev();
         expect($actual)->toBe("<?php\n");
     });
     it("gets the previous token", function () {