jclaveau /
php-deferred-callchain
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * File gathering functions |
||
| 5 | */ |
||
| 6 | if (!function_exists('type_exists')) { |
||
| 7 | /** |
||
| 8 | * Checks if a type is a valid PHP one. |
||
| 9 | * |
||
| 10 | * @param string $type_name The type name to check |
||
| 11 | * @return bool The result |
||
| 12 | */ |
||
| 13 | function type_exists($type_name) |
||
| 14 | { |
||
| 15 | return in_array($type_name, ["boolean", "integer", "double", "string", "array", "object", "resource", "resource (closed)", "NULL", "unknown type"]); |
||
| 16 | } |
||
| 17 | } |
||
| 18 | if (!function_exists('later')) { |
||
| 19 | /** |
||
| 20 | * Create a deferred call chain in a functionnal way. |
||
| 21 | * |
||
| 22 | * @param string $class_type_interface_or_instance The expected target class/type/interface/instance |
||
| 23 | * @return \JClaveau\Async\DeferredCallChain |
||
| 24 | */ |
||
| 25 | function later($class_type_interface_or_instance = null) |
||
| 26 | { |
||
| 27 | return new \JClaveau\Async\DeferredCallChain(...func_get_args()); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 28 | } |
||
| 29 | } |