| Total Complexity | 4 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Changes | 6 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php namespace Nord\Lumen\Cors; |
||
| 6 | class CorsServiceProvider extends ServiceProvider |
||
| 7 | { |
||
| 8 | const CONFIG_KEY = 'cors'; |
||
| 9 | |||
| 10 | /** |
||
| 11 | * @inheritdoc |
||
| 12 | */ |
||
| 13 | public function register(): void |
||
| 14 | { |
||
| 15 | // In Lumen application configuration files needs to be loaded implicitly |
||
| 16 | if ($this->app instanceof \Laravel\Lumen\Application) { |
||
| 17 | $this->app->configure(self::CONFIG_KEY); |
||
| 18 | } else { |
||
| 19 | $this->publishes([$this->configPath() => config_path('cors.php')]); |
||
|
|
|||
| 20 | } |
||
| 21 | |||
| 22 | $this->registerBindings(); |
||
| 23 | } |
||
| 24 | |||
| 25 | |||
| 26 | /** |
||
| 27 | * Registers container bindings. |
||
| 28 | */ |
||
| 29 | protected function registerBindings(): void |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Default config file path |
||
| 41 | * |
||
| 42 | * @return string |
||
| 43 | */ |
||
| 44 | protected function configPath(): string |
||
| 47 | } |
||
| 48 | } |
||
| 49 |