Textpattern PHP Cross Reference Content Management Systems

Summary: /textpattern/vendors/Textpattern/Type/TypeCallable.php - 139 lines - 3314 bytes - Source - Print

Description: Callable object.

Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

TypeCallable:: (3 methods):
__construct()
__toString()
toString()

Class: TypeCallable


__construct($callable line: 49
Constructor.

param: string $callable The callable
__toString()  line: 60
Gets the callable string presentation.

return: string
toString()  line: 71
Converts a callable to a string presentation.

If the callable is an object, returns the class name. For a callable
array of object and method, a 'class::staticMethod' or a 'class->method',
and for functions the name.

<code>
echo (string) Txp::get('\Textpattern\Type\TypeCallable', function () {return 'Hello world!';});
</code>

Returns 'Closure'.

<code>
echo (string) Txp::get('\Textpattern\Type\TypeCallable', array('DateTimeZone', 'listAbbreviations'));
</code>

Returns 'DateTimeZone::listAbbreviations'.

<code>
echo (string) Txp::get('\Textpattern\Type\TypeCallable', array(new DateTime(), 'setTime'));
</code>

Returns 'DateTime->setTime'.

<code>
echo (string) Txp::get('\Textpattern\Type\TypeCallable', 'date');
</code>

Returns 'date'.

<code>
echo (string) Txp::get('\Textpattern\Type\TypeCallable', 1);
</code>

Returns ''.

return: string The callable as a human-readable string

title

Body