| 1 | <?php | ||
| 7 | class MacroRegistrar | ||
| 8 | { | ||
| 9 | /** | ||
| 10 | * Register needed macros. | ||
| 11 | * | ||
| 12 | * @param \Illuminate\Contracts\Container\Container $container | ||
| 13 | * @return void | ||
| 14 | */ | ||
| 15 | 3 | public function registerMacros(Container $container) | |
| 16 |     { | ||
| 17 | 3 | $this->register( | |
| 18 | 3 | $container['url'], | |
| 19 | 3 | 'getRootControllerNamespace', | |
| 20 |             function () { | ||
| 21 | /* @var $this \Illuminate\Routing\UrlGenerator */ | ||
| 22 | 2 | return $this->rootNamespace; | |
| 23 | } | ||
| 24 | 3 | ); | |
| 25 | |||
| 26 | 3 | $this->register( | |
| 27 | 3 | $container['router'], | |
| 28 | 3 | 'hasMiddlewareGroup', | |
| 29 |             function ($name) { | ||
| 30 | /* @var $this \Illuminate\Routing\Router */ | ||
| 31 | return array_key_exists($name, $this->middlewareGroups); | ||
| 32 | } | ||
| 33 | 3 | ); | |
| 34 | 3 | } | |
| 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 | 4 | public function register($class, $method, $macro) | |
| 52 | } | ||
| 53 |