Documentation

Xcallable
in package

Class Hoa\Consistency\Xcallable.

Build a callable object, i.e. function, class::method, object->method or closure, they all have the same behaviour. This callable is an extension of native PHP callable (aka callback) to integrate Hoa's structures.

Tags
copyright

Copyright © 2007-2017 Hoa community

license

New BSD License

Table of Contents

Properties

$_callback  : mixed
Callback, with the PHP format.
$_hash  : string
Callable hash.

Methods

__construct()  : mixed
Build a callback.
__invoke()  : mixed
Call the callable.
__toString()  : string
Return the hash.
distributeArguments()  : mixed
Distribute arguments according to an array.
getHash()  : string
Get hash.
getReflection()  : Reflector
Get appropriated reflection instance.
getValidCallback()  : mixed
Get a valid callback in the PHP meaning.

Properties

$_callback

Callback, with the PHP format.

protected mixed $_callback = null

$_hash

Callable hash.

protected string $_hash = null

Methods

__construct()

Build a callback.

public __construct(mixed $call[, mixed $able = '' ]) : mixed

Accepted forms:

  • 'function',
  • 'class::method',
  • 'class', 'method',
  • $object, 'method',
  • $object, '',
  • function (…) { … },
  • ['class', 'method'],
  • [$object, 'method'].
Parameters
$call : mixed

First callable part.

$able : mixed = ''

Second callable part (if needed).

__invoke()

Call the callable.

public __invoke() : mixed

__toString()

Return the hash.

public __toString() : string
Return values
string

distributeArguments()

Distribute arguments according to an array.

public distributeArguments(array<string|int, mixed> $arguments) : mixed
Parameters
$arguments : array<string|int, mixed>

Arguments.

getHash()

Get hash.

public getHash() : string

Will produce:

  • function#…;
  • class#…::…;
  • object(…)#…::…;
  • closure(…).
Return values
string

getReflection()

Get appropriated reflection instance.

public getReflection() : Reflector
Return values
Reflector

getValidCallback()

Get a valid callback in the PHP meaning.

public getValidCallback([array<string|int, mixed> &$arguments = [] ]) : mixed
Parameters
$arguments : array<string|int, mixed> = []

Arguments (could determine method on an object if not precised).


        
On this page

Search results