1 | <?php |
||
5 | class Callback |
||
6 | { |
||
7 | /** |
||
8 | * The normalized callable. |
||
9 | * @var mixed |
||
10 | */ |
||
11 | protected $target; |
||
12 | |||
13 | /** |
||
14 | * Create a new Callback instance |
||
15 | * |
||
16 | * @param callable $target The callback to wrap |
||
17 | */ |
||
18 | public function __construct(callable $target) |
||
22 | |||
23 | /** |
||
24 | * Normalize the callable syntax |
||
25 | * |
||
26 | * Converts string static class method to standard callable array. |
||
27 | * |
||
28 | * @param mixed $callback Target callback |
||
29 | * |
||
30 | * @return mixed Closure Anonymous function |
||
31 | * array Class method |
||
32 | * string Function |
||
33 | */ |
||
34 | public static function normalizeSyntax(callable $callback) |
||
42 | |||
43 | /** |
||
44 | * Call the target callable |
||
45 | * |
||
46 | * @return mixed Returns the return value of the callback, or FALSE on error. |
||
47 | */ |
||
48 | public function call() |
||
52 | |||
53 | /** |
||
54 | * Call the target callable, with an array of arguments |
||
55 | * |
||
56 | * @param array $arguments The parameters to be passed to the callback, as an indexed array. |
||
57 | * @return mixed Returns the return value of the callback, or FALSE on error. |
||
58 | */ |
||
59 | public function callArray(array $arguments = []) |
||
63 | |||
64 | /** |
||
65 | * Get the target callable |
||
66 | * |
||
67 | * @return mixed The normalized callable |
||
68 | */ |
||
69 | public function get() |
||
73 | |||
74 | /** |
||
75 | * Get the number of parameters from the callback's signature |
||
76 | * |
||
77 | * @return int |
||
78 | */ |
||
79 | public function parameterCount() |
||
83 | |||
84 | /** |
||
85 | * Get the corresponding Reflection instance for the target callable |
||
86 | * |
||
87 | * @return \ReflectionFunctionAbstract |
||
88 | */ |
||
89 | public function reflect() |
||
101 | } |
||
102 |