updated rules
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file Extendable Object Faces API. Provided by the faces module.
|
||||
* @file
|
||||
* Extendable Object Faces API. Provided by the faces module.
|
||||
*/
|
||||
|
||||
if (!interface_exists('FacesExtenderInterface', FALSE)) {
|
||||
@@ -14,12 +15,13 @@ if (!interface_exists('FacesExtenderInterface', FALSE)) {
|
||||
/**
|
||||
* Constructs an instance of the extender.
|
||||
*/
|
||||
function __construct(FacesExtendable $object);
|
||||
public function __construct(FacesExtendable $object);
|
||||
|
||||
/**
|
||||
* Returns the extended object.
|
||||
*/
|
||||
public function getExtendable();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -31,9 +33,10 @@ if (!interface_exists('FacesExtenderInterface', FALSE)) {
|
||||
|
||||
if (!class_exists('FacesExtender', FALSE)) {
|
||||
/**
|
||||
* A common base class for FacesExtenders. Extenders may access protected
|
||||
* methods and properties of the extendable using the property() and call()
|
||||
* methods.
|
||||
* A common base class for FacesExtenders.
|
||||
*
|
||||
* Extenders may access protected methods and properties of the extendable
|
||||
* using the property() and call() methods.
|
||||
*/
|
||||
abstract class FacesExtender implements FacesExtenderInterface {
|
||||
|
||||
@@ -42,8 +45,7 @@ if (!class_exists('FacesExtender', FALSE)) {
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
|
||||
function __construct(FacesExtendable $object) {
|
||||
public function __construct(FacesExtendable $object) {
|
||||
$this->object = $object;
|
||||
}
|
||||
|
||||
@@ -63,17 +65,17 @@ if (!class_exists('FacesExtender', FALSE)) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes any method on the extended object. May be used to invoke
|
||||
* protected methods.
|
||||
* Invokes any method on the extended object, including protected methods.
|
||||
*
|
||||
* @param $name
|
||||
* @param string $name
|
||||
* The method name.
|
||||
* @param $arguments
|
||||
* @param array $args
|
||||
* An array of arguments to pass to the method.
|
||||
*/
|
||||
protected function call($name, array $args = array()) {
|
||||
return $this->object->call($name, $args);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +110,7 @@ if (!class_exists('FacesExtendable', FALSE)) {
|
||||
/**
|
||||
* Magic method: Invoke the dynamically implemented methods.
|
||||
*/
|
||||
function __call($name, $arguments = array()) {
|
||||
public function __call($name, $arguments = array()) {
|
||||
if (isset($this->facesMethods[$name])) {
|
||||
$method = $this->facesMethods[$name];
|
||||
// Include code, if necessary.
|
||||
@@ -134,9 +136,11 @@ if (!class_exists('FacesExtendable', FALSE)) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the extender object for the given class. May be used to
|
||||
* explicitly invoke a specific extender, e.g. a function overriding a
|
||||
* method may use that to explicitly invoke the original extender.
|
||||
* Returns the extender object for the given class.
|
||||
*
|
||||
* May be used to explicitly invoke a specific extender, e.g. a function
|
||||
* overriding a method may use that to explicitly invoke the original
|
||||
* extender.
|
||||
*/
|
||||
public function extender($class) {
|
||||
if (!isset($this->facesClassInstances[$class])) {
|
||||
@@ -146,14 +150,17 @@ if (!class_exists('FacesExtendable', FALSE)) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the object can face as the given interface.
|
||||
*
|
||||
* Returns whether the object can face as the given interface, thus it
|
||||
* returns TRUE if this oject has been extended by an appropriate
|
||||
* returns TRUE if this object has been extended by an appropriate
|
||||
* implementation.
|
||||
*
|
||||
* @param $interface
|
||||
* Optional. A interface to test for. If it's omitted, all interfaces that
|
||||
* the object can be faced as are returned.
|
||||
* @return
|
||||
* Optional. An interface to test for. If it's omitted, all interfaces
|
||||
* that the object can be faced as are returned.
|
||||
*
|
||||
* @return bool
|
||||
* Whether the object can face as the interface or an array of interface
|
||||
* names.
|
||||
*/
|
||||
@@ -169,9 +176,9 @@ if (!class_exists('FacesExtendable', FALSE)) {
|
||||
*
|
||||
* @param $interface
|
||||
* The interface name or an array of interface names.
|
||||
* @param $class
|
||||
* @param $className
|
||||
* The extender class, which has to implement the FacesExtenderInterface.
|
||||
* @param $include
|
||||
* @param array $includes
|
||||
* An optional array describing the file to include before invoking the
|
||||
* class. The array entries known are 'type', 'module', and 'name'
|
||||
* matching the parameters of module_load_include(). Only 'module' is
|
||||
@@ -206,10 +213,10 @@ if (!class_exists('FacesExtendable', FALSE)) {
|
||||
* @param $interface
|
||||
* The interface name or FALSE to extend the object without a given
|
||||
* interface.
|
||||
* @param $methods
|
||||
* @param array $callbacks
|
||||
* An array, where the keys are methods of the given interface and the
|
||||
* values the callback functions to use.
|
||||
* @param $includes
|
||||
* @param array $includes
|
||||
* An optional array to describe files to include before invoking the
|
||||
* callbacks. You may pass a single array describing one include for all
|
||||
* callbacks or an array of arrays, keyed by the method names. Look at the
|
||||
@@ -234,11 +241,11 @@ if (!class_exists('FacesExtendable', FALSE)) {
|
||||
/**
|
||||
* Override the implementation of an extended method.
|
||||
*
|
||||
* @param $methods
|
||||
* An array of methods of the interface, that should be overriden, where
|
||||
* @param array $callbacks
|
||||
* An array of methods of the interface, that should be overridden, where
|
||||
* the keys are methods to override and the values the callback functions
|
||||
* to use.
|
||||
* @param $includes
|
||||
* @param array $includes
|
||||
* An optional array to describe files to include before invoking the
|
||||
* callbacks. You may pass a single array describing one include for all
|
||||
* callbacks or an array of arrays, keyed by the method names. Look at the
|
||||
@@ -257,6 +264,7 @@ if (!class_exists('FacesExtendable', FALSE)) {
|
||||
|
||||
/**
|
||||
* Adds in include files for the given methods while removing any old files.
|
||||
*
|
||||
* If a single include file is described, it's added for all methods.
|
||||
*/
|
||||
protected function addIncludes($methods, $includes) {
|
||||
@@ -272,6 +280,8 @@ if (!class_exists('FacesExtendable', FALSE)) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroys all references to created instances.
|
||||
*
|
||||
* Destroys all references to created instances so that PHP's garbage
|
||||
* collection can do its work. This is needed as PHP's gc has troubles with
|
||||
* circular references until PHP < 5.3.
|
||||
@@ -296,9 +306,9 @@ if (!class_exists('FacesExtendable', FALSE)) {
|
||||
* This also allows to pass arguments by reference, so it may be used to
|
||||
* pass arguments by reference to dynamically extended methods.
|
||||
*
|
||||
* @param $name
|
||||
* @param string $name
|
||||
* The method name.
|
||||
* @param $arguments
|
||||
* @param array $args
|
||||
* An array of arguments to pass to the method.
|
||||
*/
|
||||
public function call($name, array $args = array()) {
|
||||
@@ -307,5 +317,7 @@ if (!class_exists('FacesExtendable', FALSE)) {
|
||||
}
|
||||
return $this->__call($name, $args);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user