QueryPath\ExtensionRegistry::extend PHP Method

extend() public static method

Extend a Query with the given extension class.
public static extend ( $classname )
    public static function extend($classname)
    {
        self::$extensionRegistry[] = $classname;
        $class = new \ReflectionClass($classname);
        $methods = $class->getMethods();
        foreach ($methods as $method) {
            self::$extensionMethodRegistry[$method->getName()] = $classname;
        }
    }

Usage Example

Example #1
0
 /**
  * Enable one or more extensions.
  *
  * Extensions provide additional features to QueryPath. To enable and 
  * extension, you can use this method.
  *
  * In this example, we enable the QPTPL extension:
  * @code
  * <?php
  * QueryPath::enable('\QueryPath\QPTPL');
  * ?>
  * @endcode
  *
  * Note that the name is a fully qualified class name.
  *
  * We can enable more than one extension at a time like this:
  *
  * @code
  * <?php
  * $extensions = array('\QueryPath\QPXML', '\QueryPath\QPDB');
  * QueryPath::enable($extensions);
  * ?>
  * @endcode
  *
  * @attention If you are not using an autoloader, you will need to
  * manually `require` or `include` the files that contain the
  * extensions.
  *
  * @param mixed $extensionNames
  *   The name of an extension or an array of extension names.
  *   QueryPath assumes that these are extension class names,
  *   and attempts to register these as QueryPath extensions.
  */
 public static function enable($extensionNames)
 {
     if (is_array($extensionNames)) {
         foreach ($extensionNames as $extension) {
             \QueryPath\ExtensionRegistry::extend($extension);
         }
     } else {
         \QueryPath\ExtensionRegistry::extend($extensionNames);
     }
 }
All Usage Examples Of QueryPath\ExtensionRegistry::extend