PHP Class QueryPath\ExtensionRegistry

QueryPath extensions should call the QueryPath::ExtensionRegistry::extend() function to register their extension classes. The QueryPath library then uses this information to determine what QueryPath extensions should be loaded and executed. Extensions are attached to a Query object. To enable an extension (the easy way), use QueryPath::enable(). This class provides lower-level interaction with the extension mechanism.
Show file Open project: microweber/microweber Class Usage Examples

Public Properties

Property Type Description
$useRegistry Internal flag indicating whether or not the registry should be used for automatic extension loading. If this is false, then implementations should not automatically load extensions.

Protected Properties

Property Type Description
$extensionMethodRegistry
$extensionRegistry The extension registry. This should consist of an array of class names.

Public Methods

Method Description
autoloadExtensions ( $boolean = true ) Enable or disable automatic extension loading.
extend ( $classname ) Extend a Query with the given extension class.
extensionNames ( )
getExtensions ( querypath\Query $qp ) : array Get extensions for the given Query object.
getMethodClass ( string $name ) : string Get the class that a given method belongs to.
hasExtension ( string $name ) : boolean Check to see if the given extension class is registered.
hasMethod ( string $name ) : boolean Check to see if a method is known.

Method Details

autoloadExtensions() public static method

If extension autoloading is disabled, then QueryPath will not automatically load all registred extensions when a new Query object is created using qp().
public static autoloadExtensions ( $boolean = true )

extend() public static method

Extend a Query with the given extension class.
public static extend ( $classname )

extensionNames() public static method

public static extensionNames ( )

getExtensions() public static method

Given a Query object, this will return an associative array of extension names to (new) instances. Generally, this is intended to be used internally.
public static getExtensions ( querypath\Query $qp ) : array
$qp querypath\Query The Query into which the extensions should be registered.
return array An associative array of classnames to instances.

getMethodClass() public static method

Given a method name, this will check all registered extension classes to see if any of them has the named method. If so, this will return the classname. Note that if two extensions are registered that contain the same method name, the last one registred will be the only one recognized.
public static getMethodClass ( string $name ) : string
$name string The name of the method.
return string The name of the class.

hasExtension() public static method

Given a class name for a QueryPath::Extension class, this will check to see if that class is registered. If so, it will return TRUE.
public static hasExtension ( string $name ) : boolean
$name string The name of the class.
return boolean TRUE if the class is registered, FALSE otherwise.

hasMethod() public static method

This checks to see if the given method name belongs to one of the registered extensions. If it does, then this will return TRUE.
public static hasMethod ( string $name ) : boolean
$name string The name of the method to search for.
return boolean TRUE if the method exists, false otherwise.

Property Details

$extensionMethodRegistry protected static property

protected static $extensionMethodRegistry

$extensionRegistry protected static property

The extension registry. This should consist of an array of class names.
protected static $extensionRegistry

$useRegistry public static property

Internal flag indicating whether or not the registry should be used for automatic extension loading. If this is false, then implementations should not automatically load extensions.
public static $useRegistry