1 | <?php |
||
7 | trait Macroable |
||
8 | { |
||
9 | /** |
||
10 | * @var callable[] |
||
11 | */ |
||
12 | protected static $macros = []; |
||
13 | |||
14 | /** |
||
15 | * @param string $method |
||
16 | * @param callable|null $callback |
||
17 | */ |
||
18 | public static function macro($method, callable $callback = null) |
||
26 | |||
27 | /** |
||
28 | * @param string $method |
||
29 | * |
||
30 | * @return bool |
||
31 | */ |
||
32 | public function hasMacro($method) |
||
36 | |||
37 | /** |
||
38 | * @param string $method |
||
39 | * |
||
40 | * @return callable |
||
41 | */ |
||
42 | public function getMacro($method) |
||
46 | |||
47 | /** |
||
48 | * @param string $method |
||
49 | * @param array $params |
||
50 | * |
||
51 | * @return mixed |
||
52 | */ |
||
53 | public function callMacro($method, array $params = []) |
||
60 | } |
||
61 |