@@ 19-27 (lines=9) @@ | ||
16 | * @param string $method |
|
17 | * @param string $wrap |
|
18 | */ |
|
19 | public static function addWrapperMethodToInstance($instance, $method, $wrap) |
|
20 | { |
|
21 | // hasMethod() trigger the population of $extra_methods |
|
22 | $instance->hasMethod('UnexistentMethod'); |
|
23 | self::$extra_methods[get_class($instance)][strtolower($method)] = [ |
|
24 | 'wrap' => $wrap, |
|
25 | 'method' => $method, |
|
26 | ]; |
|
27 | } |
|
28 | ||
29 | /** |
|
30 | * Add callback as a method. |
|
@@ 39-46 (lines=8) @@ | ||
36 | * @param string $method |
|
37 | * @param \Closure $callback |
|
38 | */ |
|
39 | public static function addCallbackMethodToInstance($instance, $method, $callback) |
|
40 | { |
|
41 | // hasMethod() trigger the population of $extra_methods |
|
42 | $instance->hasMethod('UnexistentMethod'); |
|
43 | self::$extra_methods[get_class($instance)][strtolower($method)] = [ |
|
44 | 'callback' => $callback, |
|
45 | ]; |
|
46 | } |
|
47 | } |
|
48 |