public function getNextExpectedTerminated($expectedCodesOrValues, $terminationToken)
    {
        $buffer = null;

        if (!is_array($terminationToken)) {
            $terminationToken = [$terminationToken];
        }

        while (($nextToken = $this->getNext()) !== null) {
            $code = $this->getCurrentCode();
            $text = $this->getCurrentText();

            if (in_array($code, $expectedCodesOrValues) || in_array($text, $expectedCodesOrValues)) {
                $buffer .= $text;
                continue;
            }

            if (in_array($code, $terminationToken)) {
                return $buffer;
            }

            if (in_array($text, $terminationToken)) {
                return $buffer;
            }

            // The token should be either expected or termination. 
            // If something else is found, return null.
            return null;
        }

        return $buffer;
    }