src/text/parser/TextParser.php
protected function is($methodName /*, $arg1, $arg2, $arg3 ... */)
    {
        if (!method_exists($this, $methodName)) {
            throw new TextParserException(
                "The method `$methodName` does not exist"
            );
        }

        if (!is_callable(array($this, $methodName))) {
            throw new TextParserException(
                "The method `$methodName` is inaccessible"
            );
        }

        // saves offset
        $offset = $this->offset;

        // calls user function
        $ret = call_user_func_array(
            array($this, $methodName),
            array_slice(func_get_args(), 1)
        );

        // restores offset
        if (!$ret) {
            $this->offset = $offset;
        }

        return $ret;
    }
protected function is($methodName /*, $arg1, $arg2, $arg3 ... */)
    {
        if (!method_exists($this, $methodName)) {
            throw new TextParserException(
                "The method `$methodName` does not exist"
            );
        }

        if (!is_callable(array($this, $methodName))) {
            throw new TextParserException(
                "The method `$methodName` is inaccessible"
            );
        }

        // saves offset
        $offset = $this->offset;

        // calls user function
        $ret = call_user_func_array(
            array($this, $methodName),
            array_slice(func_get_args(), 1)
        );

        // restores offset
        if (!$ret) {
            $this->offset = $offset;
        }

        return $ret;
    }
protected function is ( $ methodName /*, $arg1, $arg2, $arg3 ... */ ) { if ( ! method_exists ( $ this , $ methodName ) ) { throw new TextParserException ( "The method `$methodName` does not exist" ) ; } if ( ! is_callable ( array ( $ this , $ methodName ) ) ) { throw new TextParserException ( "The method `$methodName` is inaccessible" ) ; } // saves offset $ offset = $ this -> offset ; // calls user function $ ret = call_user_func_array ( array ( $ this , $ methodName ) , array_slice ( func_get_args ( ) , 1 ) ) ; // restores offset if ( ! $ ret ) { $ this -> offset = $ offset ; } return $ ret ; }
Does the next thing satisfies a given method?

Matches the string against a function and moves the offset forward if the
function returns true.

@param string $methodName Method name

@throws TextParserException
@return mixed
Does the next thing satisfies a given method?