@@ -25,60 +25,60 @@ |
||
25 | 25 | |
26 | 26 | class ResponseBuilderServiceProvider extends ServiceProvider |
27 | 27 | { |
28 | - /** |
|
29 | - * Register bindings in the container. |
|
30 | - * |
|
31 | - * @return void |
|
32 | - */ |
|
33 | - public function register() |
|
34 | - { |
|
35 | - $this->mergeConfigFrom( |
|
36 | - __DIR__ . '/../config/response_builder.php', 'response_builder' |
|
37 | - ); |
|
38 | - } |
|
28 | + /** |
|
29 | + * Register bindings in the container. |
|
30 | + * |
|
31 | + * @return void |
|
32 | + */ |
|
33 | + public function register() |
|
34 | + { |
|
35 | + $this->mergeConfigFrom( |
|
36 | + __DIR__ . '/../config/response_builder.php', 'response_builder' |
|
37 | + ); |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * Sets up package resources |
|
42 | - * |
|
43 | - * @return void |
|
44 | - */ |
|
45 | - public function boot() |
|
46 | - { |
|
47 | - $this->loadTranslationsFrom(__DIR__ . '/lang', 'response-builder'); |
|
40 | + /** |
|
41 | + * Sets up package resources |
|
42 | + * |
|
43 | + * @return void |
|
44 | + */ |
|
45 | + public function boot() |
|
46 | + { |
|
47 | + $this->loadTranslationsFrom(__DIR__ . '/lang', 'response-builder'); |
|
48 | 48 | |
49 | - $source = __DIR__ . '/../config/response_builder.php'; |
|
50 | - $this->publishes([ |
|
51 | - $source => config_path('response_builder.php'), |
|
52 | - ]); |
|
53 | - } |
|
49 | + $source = __DIR__ . '/../config/response_builder.php'; |
|
50 | + $this->publishes([ |
|
51 | + $source => config_path('response_builder.php'), |
|
52 | + ]); |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * Merge the given configuration with the existing configuration. |
|
57 | - * |
|
58 | - * @param string $path |
|
59 | - * @param string $key |
|
60 | - * |
|
61 | - * @return void |
|
62 | - */ |
|
63 | - protected function mergeConfigFrom($path, $key) |
|
64 | - { |
|
65 | - $defaults = require $path; |
|
66 | - $config = $this->app['config']->get($key, []); |
|
55 | + /** |
|
56 | + * Merge the given configuration with the existing configuration. |
|
57 | + * |
|
58 | + * @param string $path |
|
59 | + * @param string $key |
|
60 | + * |
|
61 | + * @return void |
|
62 | + */ |
|
63 | + protected function mergeConfigFrom($path, $key) |
|
64 | + { |
|
65 | + $defaults = require $path; |
|
66 | + $config = $this->app['config']->get($key, []); |
|
67 | 67 | |
68 | - $merged_config = Util::mergeConfig($defaults, $config); |
|
68 | + $merged_config = Util::mergeConfig($defaults, $config); |
|
69 | 69 | |
70 | - // we now need to sort 'classes' node by priority |
|
71 | - uasort($merged_config['classes'], function($a, $b) { |
|
72 | - $pri_a = $a['pri'] ?? 0; |
|
73 | - $pri_b = $b['pri'] ?? 0; |
|
70 | + // we now need to sort 'classes' node by priority |
|
71 | + uasort($merged_config['classes'], function($a, $b) { |
|
72 | + $pri_a = $a['pri'] ?? 0; |
|
73 | + $pri_b = $b['pri'] ?? 0; |
|
74 | 74 | |
75 | - return $pri_b <=> $pri_a; |
|
76 | - }); |
|
75 | + return $pri_b <=> $pri_a; |
|
76 | + }); |
|
77 | 77 | |
78 | - print_r($merged_config); |
|
79 | - die(); |
|
78 | + print_r($merged_config); |
|
79 | + die(); |
|
80 | 80 | |
81 | - $this->app['config']->set($key, $merged_config); |
|
82 | - } |
|
81 | + $this->app['config']->set($key, $merged_config); |
|
82 | + } |
|
83 | 83 | |
84 | 84 | } |