lithium\analysis\Parser::token()

public static method

Convenience method to get the token name of a PHP code string. If multiple tokens are present in the string, only the first is returned.

Parameters

  • string $string

    String of PHP code to get the token name of, i.e. '=>' or 'static'.

  • array $options

Returns

mixed

Source

	public static function token($string, array $options = []) {
		$defaults = ['id' => false];
		$options += $defaults;

		if (empty($string) && $string !== '0') {
			return false;
		}
		list($token) = static::tokenize($string);
		return $token[($options['id']) ? 'id' : 'name'];
	}