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

Interface for something that can be called. More...

+ Inheritance diagram for fpoirotte\XRL\CallableInterface:

Public Member Functions

 __invoke ()
 
 __toString ()
 
 getCallable ()
 
 getReflector ()
 
 getRepresentation ()
 

Detailed Description

Interface for something that can be called.

This interface provides a generic way to define something that can be invoked to execute some code, like a function, a method (with the usual array representation used by PHP), a closure, etc.

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

Definition at line 24 of file CallableInterface.php.

Member Function Documentation

fpoirotte\XRL\CallableInterface::__invoke ( )

Implementation of the __invoke() magic method.

This method is present only for forward-compatibility and because it turns instances of fpoirotte::XRL::CallableInterface into callables themselves (ain't that neat?).

Warning
Use fpoirotte::XRL::CallableInterface::invoke(...) instead of calling this method directly or relying on its magic with code such as:
$c = new \\fpoirotte\\XRL\\CallableObject("var_dump");
$c(42);
fpoirotte\XRL\CallableInterface::__toString ( )

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

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

Implemented in fpoirotte\XRL\CallableObject.

fpoirotte\XRL\CallableInterface::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.

Implemented in fpoirotte\XRL\CallableObject.

fpoirotte\XRL\CallableInterface::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.

Implemented in fpoirotte\XRL\CallableObject.

fpoirotte\XRL\CallableInterface::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.

Implemented in fpoirotte\XRL\CallableObject.


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