Checks if text at current cursor position starts from token of given type.

@param int $type
@return string|null Token text or NULL.
@todo Split method in two.
322698
protected function matchTokenTextAtCursor(int $type)
    {
        $result = preg_match($this->getTokenPattern($type), $this->getTextAtCursor(), $matches);
        PregHelper::assertMatchResult(
            $result,
            RegExpException::class,
            "Failed to match token text due to regular expression error"
        );
        if (1 === $result) {
            $text = $matches[0];
            if (strlen($text) == 0) {
                throw new LengthException("Matched token text is empty");
            }
        } else {
            $text = null;
        }
        return $text;
    }
295492
protected function skip($type)
    {
        if ($match = ($this->token->getType() === $type)) {
            $this->advance();
        }

        return $match;
    }
853769
private function isEmpty($type) {
        switch ($type) {
            case static::GET:
                $global = &$_GET;
                break;
            case static::POST:
                $global = &$this->_getPost();
                break;
            case static::SESSION:
                $global = &$_SESSION;
                break;

            default:
                throw new \Exception("Unknown global type : " . $type);
                break;
        }
        return empty($global);
    }
230373
public function getTokenName($type)
    {
        if (!isset($this->tokenNames[$type])) {
            throw new \RuntimeException(
                "Unknown token $type."
            );
        }

        return $this->tokenNames[$type];
    }
1081222
private static function check_type($type=null) {
	if (is_null($type)) {
		return self::TYPE_CONTINUOUS;
	}
	
	if (isset(self::$type_durations[$type]) == false) {
		$exception = bootstrap::get_library('exception');
		throw new $exception('unknown session type');
	}
	
	return $type;
}
1018751
private function allowedTypeExist(string $type):bool
    {
        foreach ($this->allowed_text_render as $one) {
            if ($one["type"] === $type) {
                return (true);
            }
        }
        return (false);
    }
195659
public function lookaheadTypeIs(int $type): bool
    {
        return isset($this->tokens[$this->position]) && $this->tokens[$this->position]->typeEquals($type);
    }
564352
public function message($type = null)
    {
        switch ($type) {
            case static::MESSAGE_HTML:
                return $this->_htmlMessage;
            case static::MESSAGE_TEXT:
                return $this->_textMessage;
        }

        return $this->_message;
    }
1251923
public function first($type = 'object')
    {
        $data = self::query($type);
        if (Collection::count($data) > 0) {
            return $data[0];
        }
    }
332152
private static function findZeroIdValue(Type $type)
    {
        if ($type instanceof GuidType) {
            $value = '00000000-0000-0000-0000-000000000000';
        } elseif (self::isNumberType($type)) {
            $value = 0;
        } elseif (self::isStringType($type)) {
            $value = '';
        } else {
            $value = null;
        }

        return $value;
    }
260648
public function getClassForType(string $type):?string
    {
        if (isset($this->typeMap[$type])) {
            return $this->typeMap[$type];
        }

        return null;
    }
296737
public function findOne($type = '')
    {
        $rows = $this->findAll($type)->asArray();

        return isset($rows[0]) ? $rows[0] : null;
    }
1088699
public function getFirst($termType) {
        foreach ($this->terms as $term) {
            if ((string)$term->getTermType() === $termType) {
                return $term;
            }
        }
        return null;
    }
813861
private function is_text_col( $type ) {
		foreach ( array( 'text', 'varchar' ) as $token ) {
			if ( false !== strpos( $type, $token ) ) {
				return true;
			}
		}

		return false;
	}
223389
public function pop($type): ?\stdClass
    {
        $text = array_shift($this->getMessagesStore()[$type]);
        if ($text) {
            $message = new \stdClass();
            $message->text = $text;
            $message->type = $type;
            return $message;
        }
        return null;
    }
343030
public function peekUntil($type, $value = null)
    {
        while($token = $this->peek() and !$token->test($type, $value)) {
            $token = null;
        }
        return $token;
    }
831916
protected static function extractType($type)
    {
        if (substr($type, -2) === Connection::PARAM_ARRAY) {
            return substr($type, 0, strlen($type) - 2);
        }

        return false;
    }