1 | <?php |
||
17 | trait Macroable |
||
18 | { |
||
19 | /** |
||
20 | * The registered string macros. |
||
21 | * |
||
22 | * @var array |
||
23 | */ |
||
24 | protected static $macros = []; |
||
25 | |||
26 | /** |
||
27 | * Register a custom macro. |
||
28 | * |
||
29 | * @param string $name |
||
30 | * @param callable $macro |
||
31 | */ |
||
32 | 4 | public static function macro($name, callable $macro) |
|
36 | |||
37 | /** |
||
38 | * Check if macro is registered. |
||
39 | * |
||
40 | * @param string $name |
||
41 | * |
||
42 | * @return bool |
||
43 | */ |
||
44 | 4 | public static function hasMacro($name) |
|
48 | |||
49 | /** |
||
50 | * Dynamically handle calls to the class. |
||
51 | * |
||
52 | * @param string $method |
||
53 | * @param array $arguments |
||
54 | * |
||
55 | * @throws \BadMethodCallException |
||
56 | * |
||
57 | * @return mixed |
||
58 | */ |
||
59 | 3 | public static function __callStatic($method, $arguments) |
|
72 | |||
73 | /** |
||
74 | * Dynamically handle calls to the class. |
||
75 | * |
||
76 | * @param $name |
||
77 | * @param $arguments |
||
78 | * |
||
79 | * @throws \BadMethodCallException |
||
80 | * |
||
81 | * @return mixed |
||
82 | */ |
||
83 | 1 | public function __call($name, $arguments) |
|
96 | } |
||
97 |