\QueryPathExtensionRegistry

A registry for QueryPath extensions.

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.

Summary

Methods
Properties
Constants
extend()
hasMethod()
hasExtension()
getMethodClass()
getExtensions()
extensionNames()
autoloadExtensions()
$useRegistry
No constants found
No protected methods found
$extensionRegistry
$extensionMethodRegistry
N/A
No private methods found
No private properties found
N/A

Properties

$useRegistry

$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.

Type

$extensionRegistry

$extensionRegistry : 

The extension registry. This should consist of an array of class names.

Type

$extensionMethodRegistry

$extensionMethodRegistry : 

Type

Methods

extend()

extend(  $classname) 

Extend a Query with the given extension class.

Parameters

$classname

hasMethod()

hasMethod(string  $name) : boolean

Check to see if a method is known.

This checks to see if the given method name belongs to one of the registered extensions. If it does, then this will return TRUE.

Parameters

string $name

The name of the method to search for.

Returns

boolean —

TRUE if the method exists, false otherwise.

hasExtension()

hasExtension(string  $name) : boolean

Check to see if the given extension class is registered.

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.

Parameters

string $name

The name of the class.

Returns

boolean —

TRUE if the class is registered, FALSE otherwise.

getMethodClass()

getMethodClass(string  $name) : string

Get the class that a given method belongs to.

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.

Parameters

string $name

The name of the method.

Returns

string —

The name of the class.

getExtensions()

getExtensions(\QueryPath\Query  $qp) : array

Get extensions for the given Query object.

Given a Query object, this will return an associative array of extension names to (new) instances. Generally, this is intended to be used internally.

Parameters

\QueryPath\Query $qp

The Query into which the extensions should be registered.

Returns

array —

An associative array of classnames to instances.

extensionNames()

extensionNames() 

autoloadExtensions()

autoloadExtensions(  $boolean = TRUE) 

Enable or disable automatic extension loading.

If extension autoloading is disabled, then QueryPath will not automatically load all registred extensions when a new Query object is created using qp().

Parameters

$boolean