XRL
2.0.0
Simple XML-RPC Library (both client and server)
|
Class used to represent anything that is callable. More...
Public Member Functions | |
__construct ($callable) | |
__invoke () | |
__toString () | |
getCallable () | |
getReflector () | |
getRepresentation () | |
invoke () | |
invokeArgs (array &$args) | |
Protected Attributes | |
$callableObj | |
Inner callable object, as used by PHP. | |
$representation | |
Human representation of the inner callable. | |
Class used to represent anything that is callable.
This class can represent a wild range of callable items supported by PHP (functions, lambdas, methods, closures, etc.).
Definition at line 23 of file CallableObject.php.
fpoirotte\XRL\CallableObject::__construct | ( | $callable | ) |
Constructs a new callable object, abstracting differences between the different constructs PHP supports.
mixed | $callable | A callable item. It must be compatible with the PHP callback pseudo-type. |
InvalidArgumentException | The given item is not compatible with the PHP callback pseudo-type. |
Definition at line 48 of file CallableObject.php.
References fpoirotte\XRL\CallableObject\$representation.
fpoirotte\XRL\CallableObject::__invoke | ( | ) |
Implements fpoirotte\XRL\CallableInterface.
Definition at line 109 of file CallableObject.php.
fpoirotte\XRL\CallableObject::__toString | ( | ) |
Alias for fpoirotte::XRL::CallableInterface::getRepresentation().
string | Human representation of this callable. |
Implements fpoirotte\XRL\CallableInterface.
Definition at line 135 of file CallableObject.php.
References fpoirotte\XRL\CallableObject\$representation.
fpoirotte\XRL\CallableObject::getCallable | ( | ) |
Returns the callable object in its raw form (as used by PHP).
string | The name of the function this callable represents, which can be either a core function, a user-defined function, or the result of a call to create_function(). |
array | An array whose contents matches the definition of a PHP callback, that is:
|
object | Either a Closure object or an instance of a class that implements the __invoke() magic method. |
Implements fpoirotte\XRL\CallableInterface.
Definition at line 65 of file CallableObject.php.
References fpoirotte\XRL\CallableObject\$callableObj.
fpoirotte\XRL\CallableObject::getReflector | ( | ) |
Get a reflection objets for the function/method/object represented by this callable.
Reflector | Reflection object for this callable's inner PHP callback. |
Implements fpoirotte\XRL\CallableInterface.
Definition at line 141 of file CallableObject.php.
References fpoirotte\XRL\CallableObject\$callableObj.
fpoirotte\XRL\CallableObject::getRepresentation | ( | ) |
Returns a human representation of this callable. For (anonymous) functions, this is a string containing the name of that function. For methods and classes that implement the __invoke() magic method (including Closures), this is a string of the form "ClassName::methodname".
string | Human representation of this callable. |
Implements fpoirotte\XRL\CallableInterface.
Definition at line 71 of file CallableObject.php.
References fpoirotte\XRL\CallableObject\$representation.
fpoirotte\XRL\CallableObject::invoke | ( | ) |
Implements fpoirotte\XRL\CallableInterface.
Definition at line 77 of file CallableObject.php.
fpoirotte\XRL\CallableObject::invokeArgs | ( | array & | $args | ) |
Invokes the callable object represented by this instance, using the given array as a list of arguments.
array | $args | An array whose values will become the arguments for the inner callable. |
mixed | Value returned by the inner callable. |
Implements fpoirotte\XRL\CallableInterface.
Definition at line 103 of file CallableObject.php.