public static function offset(array $tokens, $index)
    {
        if (count($tokens) < 1) {
            return 0;
        }

        if (null === $index) {
            $index = count($tokens) - 1;
        }

        $source = '';

        for ($i = 0; $i < $index; ++$i) {
            $source .= $tokens[$i]->content();
        }

        return strlen($source);
    }
public static function offset(array $tokens, $index)
    {
        if (count($tokens) < 1) {
            return 0;
        }

        if (null === $index) {
            $index = count($tokens) - 1;
        }

        $source = '';

        for ($i = 0; $i < $index; ++$i) {
            $source .= $tokens[$i]->content();
        }

        return strlen($source);
    }
public static function offset ( array $ tokens , $ index ) { if ( count ( $ tokens ) < 1 ) { return 0 ; } if ( null === $ index ) { $ index = count ( $ tokens ) - 1 ; } $ source = '' ; for ( $ i = 0 ; $ i < $ index ; ++ $ i ) { $ source .= $ tokens [ $ i ] -> content ( ) ; } return strlen ( $ source ) ; }
Calculate the offset from a list of tokens.

@param array<TypeToken> $tokens The tokens.
@param integer|null     $index  The index at which parsing stopped.

@return integer The offset.
Calculate the offset from a list of tokens .