XRL  latest
Simple XML-RPC Library (both client and server)
fpoirotte\XRL\CallableObject Class Reference

Class used to represent anything that is callable. More...

+ Inheritance diagram for fpoirotte\XRL\CallableObject:

Public Member Functions

 __construct ($callable)
 
 __invoke (&...$args)
 
 __toString ()
 
 getCallable ()
 
 getReflector ()
 
 getRepresentation ()
 
- Public Member Functions inherited from fpoirotte\XRL\CallableInterface
 __invoke ()
 

Protected Attributes

 $callableObj
 Inner callable object, as used by PHP.
 
 $representation
 Human representation of the inner callable.
 

Detailed Description

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

Authors
François Poirotte click.nosp@m.y@er.nosp@m.ebot..nosp@m.net

Definition at line 23 of file CallableObject.php.

Constructor & Destructor Documentation

fpoirotte\XRL\CallableObject::__construct (   $callable)

Constructs a new callable object, abstracting differences between the different constructs PHP supports.

Parameters
mixed$callableA callable item. It must be compatible with the PHP callback pseudo-type.
Exceptions
InvalidArgumentExceptionThe given item is not compatible with the PHP callback pseudo-type.
See also
More information on the callback pseudo-type can be found here: http://php.net/language.pseudo-types.php#language.types.callback

Definition at line 48 of file CallableObject.php.

References fpoirotte\XRL\CallableObject\$representation.

Member Function Documentation

fpoirotte\XRL\CallableObject::__invoke ( &...  $args)

Definition at line 77 of file CallableObject.php.

fpoirotte\XRL\CallableObject::__toString ( )

Alias for fpoirotte::XRL::CallableInterface::getRepresentation().

Return values
stringHuman representation of this callable.
See also
fpoirotte::XRL::CallableInterface::getRepresentation()

Implements fpoirotte\XRL\CallableInterface.

Definition at line 83 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).

Return values
stringThe 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().
arrayAn array whose contents matches the definition of a PHP callback, that is:
  • The first element refers to either an object, a class name or one of the reserved keywords (self, parent, static, etc.).
  • The second element is the name of a method from that object/class.
objectEither 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.

Return values
ReflectorReflection object for this callable's inner PHP callback.

Implements fpoirotte\XRL\CallableInterface.

Definition at line 89 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".

Return values
stringHuman representation of this callable.

Implements fpoirotte\XRL\CallableInterface.

Definition at line 71 of file CallableObject.php.

References fpoirotte\XRL\CallableObject\$representation.


The documentation for this class was generated from the following file: