1 | <?php |
||
10 | trait Macroable |
||
11 | { |
||
12 | /** |
||
13 | * The registered string macros. |
||
14 | * |
||
15 | * @var array |
||
16 | */ |
||
17 | protected static $macros = []; |
||
18 | |||
19 | /** |
||
20 | * Register a custom macro. |
||
21 | * |
||
22 | * @param string $name |
||
23 | * @param object|callable $macro |
||
24 | * |
||
25 | * @return void |
||
26 | */ |
||
27 | 7 | public static function macro($name, $macro) |
|
31 | |||
32 | /** |
||
33 | * Mix another object into the class. |
||
34 | * |
||
35 | * @param object $mixin |
||
36 | * @return void |
||
37 | * |
||
38 | * @throws \ReflectionException |
||
39 | */ |
||
40 | public static function mixin($mixin) |
||
52 | |||
53 | 2 | /** |
|
54 | * Checks if macro is registered. |
||
55 | * |
||
56 | * @param string $name |
||
57 | * @return bool |
||
58 | */ |
||
59 | public static function hasMacro($name) |
||
63 | 7 | ||
64 | /** |
||
65 | * Dynamically handle calls to the class. |
||
66 | * |
||
67 | * @param string $method |
||
68 | * @param array $parameters |
||
69 | * @return mixed |
||
70 | * |
||
71 | * @throws \BadMethodCallException |
||
72 | */ |
||
73 | public static function __callStatic($method, $parameters) |
||
87 | |||
88 | /** |
||
89 | * Dynamically handle calls to the class. |
||
90 | * |
||
91 | * @param string $method |
||
92 | * @param array $parameters |
||
93 | * @return mixed |
||
94 | * |
||
95 | * @throws \BadMethodCallException |
||
96 | */ |
||
97 | public function __call($method, $parameters) |
||
113 | } |
||
114 |