PHP 클래스 lithium\analysis\Parser

상속: extends lithium\core\StaticObject
파일 보기 프로젝트 열기: unionofrad/lithium 1 사용 예제들

공개 메소드들

메소드 설명
find ( string $code, string $pattern, array $options = [] ) : array Finds a pattern in a block of code.
match ( string $code, string $parameters, array $options = [] ) : array Token pattern matching.
matchToken ( array $pattern, array $token ) : boolean Compares two PHP language tokens.
token ( string $string, array $options = [] ) : mixed 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.
tokenize ( string $code, array $options = [] ) : array Splits the provided $code into PHP language tokens.

보호된 메소드들

메소드 설명
_prepareMatchParams ( array | string $parameters ) : array Helper function to normalize parameters for token matching.

메소드 상세

_prepareMatchParams() 보호된 정적인 메소드

Helper function to normalize parameters for token matching.
또한 보기: lithium\analysis\Parser::match()
protected static _prepareMatchParams ( array | string $parameters ) : array
$parameters array | string Params to be normalized.
리턴 array Normalized parameters.

find() 공개 정적인 메소드

Finds a pattern in a block of code.
public static find ( string $code, string $pattern, array $options = [] ) : array
$code string
$pattern string
$options array The list of options to be used when parsing / matching `$code`: - 'ignore': An array of token names to ignore while parsing, defaults to `array('T_WHITESPACE')` - 'lineBreaks': If true, all tokens in a single pattern match must appear on the same line of code, defaults to false - 'startOfLine': If true, the pattern must match starting with the beginning of the line of code to be matched, defaults to false
리턴 array

match() 공개 정적인 메소드

Token pattern matching.
public static match ( string $code, string $parameters, array $options = [] ) : array
$code string Source code to be analyzed.
$parameters string An array containing token patterns to be matched.
$options array The list of options to be used when matching `$code`: - 'ignore': An array of language tokens to ignore. - 'return': If set to 'content' returns an array of matching tokens.
리턴 array Array of matching tokens.

matchToken() 공개 정적인 메소드

Compares two PHP language tokens.
public static matchToken ( array $pattern, array $token ) : boolean
$pattern array Pattern token.
$token array Token to be compared.
리턴 boolean Match result.

token() 공개 정적인 메소드

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.
public static token ( string $string, array $options = [] ) : mixed
$string string String of PHP code to get the token name of, i.e. `'=>'` or `'static'`.
$options array
리턴 mixed

tokenize() 공개 정적인 메소드

Splits the provided $code into PHP language tokens.
public static tokenize ( string $code, array $options = [] ) : array
$code string Source code to be tokenized.
$options array Options consists of: -'wrap': Boolean indicating whether or not to wrap the supplied code in PHP tags. -'ignore': An array containing PHP language tokens to ignore. -'include': If supplied, an array of the only language tokens to include in the output.
리턴 array An array of tokens in the supplied source code.