PHP Class Eloquent\Phony\Reflection\FeatureDetector

Mostrar archivo Open project: eloquent/phony Class Usage Examples

Public Methods

Method Description
__construct ( array $features = null, array $supported = [] ) Construct a new feature detector.
addFeature ( string $feature, callable $callback ) Add a custom feature.
checkInternalClass ( string $className ) : boolean Check that the specified class is defined by the PHP core, or an extension.
checkInternalMethod ( string $className, string $methodName ) : boolean Check that the specified method is defined by the PHP core, or an extension.
checkStatement ( string $source, boolean $useClosure = true ) : boolean Check that the supplied syntax is valid.
checkToken ( string $keyword, string $constantName ) : boolean Check that a keyword is interpreted as a particular token type.
features ( ) : callable>\array Get the features.
instance ( ) : FeatureDetector Get the static instance of this detector.
isSupported ( string $feature ) : boolean Returns true if the specified feature is supported by the current runtime environment.
runtime ( ) : string Determine the current PHP runtime.
standardFeatures ( ) : callable>\array Get the standard feature detection callbacks.
supported ( ) : bool>\array Get the known feature support.
uniqueSymbolName ( ) : string Returns a symbol name that is unique for this process execution.

Method Details

__construct() public method

Construct a new feature detector.
public __construct ( array $features = null, array $supported = [] )
$features array
$supported array

addFeature() public method

The callback will be passed this detector as the first argument. The return value will be interpreted as a boolean.
public addFeature ( string $feature, callable $callback )
$feature string The feature.
$callback callable The feature detection callback.

checkInternalClass() public method

Check that the specified class is defined by the PHP core, or an extension.
public checkInternalClass ( string $className ) : boolean
$className string The class name.
return boolean True if the class exists, and is internal.

checkInternalMethod() public method

Check that the specified method is defined by the PHP core, or an extension.
public checkInternalMethod ( string $className, string $methodName ) : boolean
$className string The class name.
$methodName string The class name.
return boolean True if the method exists, and is internal.

checkStatement() public method

Check that the supplied syntax is valid.
public checkStatement ( string $source, boolean $useClosure = true ) : boolean
$source string The source to check.
$useClosure boolean True to wrap the supplied source code in a closure.
return boolean True if the syntax is valid.

checkToken() public method

Check that a keyword is interpreted as a particular token type.
public checkToken ( string $keyword, string $constantName ) : boolean
$keyword string The keyword.
$constantName string The name of the token type constant.
return boolean True if the keyword is interpreted as expected.

features() public method

Get the features.
public features ( ) : callable>\array
return callable>\array

instance() public static method

Get the static instance of this detector.
public static instance ( ) : FeatureDetector
return FeatureDetector The static detector.

isSupported() public method

Returns true if the specified feature is supported by the current runtime environment.
public isSupported ( string $feature ) : boolean
$feature string The feature.
return boolean True if supported.

runtime() public method

Determine the current PHP runtime.
public runtime ( ) : string
return string The runtime.

standardFeatures() public method

Get the standard feature detection callbacks.
public standardFeatures ( ) : callable>\array
return callable>\array

supported() public method

Get the known feature support.
public supported ( ) : bool>\array
return bool>\array

uniqueSymbolName() public method

Returns a symbol name that is unique for this process execution.
public uniqueSymbolName ( ) : string
return string The symbol name.