Total Complexity | 4 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
7 | class MacroRegistrar |
||
8 | { |
||
9 | /** |
||
10 | * Register needed macros. |
||
11 | * |
||
12 | * @param \Illuminate\Contracts\Container\Container $container |
||
13 | * @return void |
||
14 | */ |
||
15 | 28 | public function registerMacros(Container $container) |
|
16 | { |
||
17 | 28 | $this->register( |
|
18 | 28 | $container['url'], |
|
19 | 28 | 'getRootControllerNamespace', |
|
20 | function () { |
||
21 | /* @var $this \Illuminate\Routing\UrlGenerator */ |
||
22 | 8 | return $this->rootNamespace; |
|
|
|||
23 | 28 | } |
|
24 | ); |
||
25 | |||
26 | 28 | $this->register( |
|
27 | 28 | $container['router'], |
|
28 | 28 | 'hasMiddlewareGroup', |
|
29 | 7 | function ($name) { |
|
30 | /* @var $this \Illuminate\Routing\Router */ |
||
31 | 2 | return array_key_exists($name, $this->middlewareGroups); |
|
32 | 28 | } |
|
33 | ); |
||
34 | 28 | } |
|
35 | |||
36 | /** |
||
37 | * Register a macro to the class. |
||
38 | * |
||
39 | * @param string|object $class |
||
40 | * @param string $method |
||
41 | * @param object|callable $macro |
||
42 | * @return void |
||
43 | */ |
||
44 | 32 | public function register($class, $method, $macro) |
|
50 | } |
||
51 | 32 | } |
|
53 |