|
Erebot
latest
A modular IRC bot for PHP 5.3+
|
Class used to represent anything that is callable. More...
Inheritance diagram for Erebot\CallableWrapper:Public Member Functions | |
| __toString () | |
Public Member Functions inherited from Erebot\CallableInterface | |
| __invoke () | |
Static Public Member Functions | |
| static | initialize () |
| static | represent ($callable) |
| static | wrap ($callable) |
Protected Member Functions | |
| __construct ($callable) | |
Protected Attributes | |
| $callable | |
| 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 30 of file CallableWrapper.php.
|
protected |
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. |
| string | $representation | Human readable representation of the callable. |
Definition at line 54 of file CallableWrapper.php.
| Erebot\CallableWrapper::__toString | ( | ) |
Returns a human readable representation of this callable.
For functions (including anonymous functions created with create_function()), this is a string containing the name of that function. For methods and objects that implement the __invoke() magic method (including Closures), this is a string of the form "ClassName::methodName".
| string | Human readable representation of this callable. |
Definition at line 72 of file CallableWrapper.php.
|
static |
Initialize the wrapper.
| bool | $existing | (optional) Whether to inject the wrapper inside existing namespaces. You don't need to pass this argument: the wrapper already does so internally when needed. |
Definition at line 180 of file CallableWrapper.php.
Referenced by Erebot\Patches\patch().
|
static |
Returns a human readable representation of a callable.
For functions (including anonymous functions created with create_function()), this is a string containing the name of that function. For methods and objects that implement the __invoke() magic method (including Closures), this is a string of the form "ClassName::methodName".
| mixed | $callable | Callable piece of code to describe. |
| string | Human readable representation of the callable. |
| InvalidArgumentException | The given argument does not represent a callable piece of code. |
Definition at line 256 of file CallableWrapper.php.
|
static |
Wraps an existing callable piece of code.
| mixed | $callable | Callable piece of code to wrap. |
| Erebot::CallableInterface | An object of a class implementing the Erebot::CallableInterface is returned. The precise type of the object will usually vary between calls as new types are created on-the-fly if needed. |
Definition at line 90 of file CallableWrapper.php.
Referenced by Erebot\Config\Proxy\parseBool(), Erebot\Config\Proxy\parseInt(), Erebot\Config\Proxy\parseReal(), Erebot\Config\Proxy\parseString(), and Erebot\Module\Base\reloadModule().