@@ -43,18 +43,18 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function boot() |
45 | 45 | { |
46 | - if ($this->app instanceof Laravel && $this->app->runningInConsole()) { |
|
46 | + if ( $this->app instanceof Laravel && $this->app->runningInConsole() ) { |
|
47 | 47 | $this->bootLaravelApplication(); |
48 | 48 | |
49 | - } elseif ($this->app instanceof Lumen) { |
|
49 | + } elseif ( $this->app instanceof Lumen ) { |
|
50 | 50 | $this->bootLumenApplication(); |
51 | 51 | } |
52 | 52 | |
53 | - $this->mergeConfigFrom(__DIR__ . '/../resources/config/responder.php', 'responder'); |
|
53 | + $this->mergeConfigFrom( __DIR__ . '/../resources/config/responder.php', 'responder' ); |
|
54 | 54 | |
55 | - $this->commands([ |
|
55 | + $this->commands( [ |
|
56 | 56 | MakeTransformer::class |
57 | - ]); |
|
57 | + ] ); |
|
58 | 58 | |
59 | 59 | include __DIR__ . '/helpers.php'; |
60 | 60 | } |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | $this->registerFractal(); |
70 | 70 | $this->registerResponseBuilders(); |
71 | 71 | |
72 | - $this->app->bind(Responder::class, function ($app) { |
|
73 | - return new Responder($app[SuccessResponseBuilder::class], $app[ErrorResponseBuilder::class]); |
|
72 | + $this->app->bind( Responder::class, function ( $app ) { |
|
73 | + return new Responder( $app[ SuccessResponseBuilder::class ], $app[ ErrorResponseBuilder::class ] ); |
|
74 | 74 | }); |
75 | 75 | |
76 | 76 | $this->registerAliases(); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function provides() |
85 | 85 | { |
86 | - return ['responder', 'responder.success', 'responder.error', 'responder.manager', 'responder.serializer']; |
|
86 | + return [ 'responder', 'responder.success', 'responder.error', 'responder.manager', 'responder.serializer' ]; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -94,17 +94,17 @@ discard block |
||
94 | 94 | */ |
95 | 95 | protected function registerFractal() |
96 | 96 | { |
97 | - $this->app->bind(SerializerAbstract::class, function ($app) { |
|
98 | - $serializer = $app->config->get('responder.serializer'); |
|
97 | + $this->app->bind( SerializerAbstract::class, function ( $app ) { |
|
98 | + $serializer = $app->config->get( 'responder.serializer' ); |
|
99 | 99 | |
100 | 100 | return new $serializer; |
101 | 101 | }); |
102 | 102 | |
103 | - $this->app->bind(Manager::class, function ($app) { |
|
104 | - return (new Manager())->setSerializer($app[SerializerAbstract::class]); |
|
103 | + $this->app->bind( Manager::class, function ( $app ) { |
|
104 | + return (new Manager())->setSerializer( $app[ SerializerAbstract::class ] ); |
|
105 | 105 | }); |
106 | 106 | |
107 | - $this->app->bind(ResourceFactory::class, function () { |
|
107 | + $this->app->bind( ResourceFactory::class, function () { |
|
108 | 108 | return new ResourceFactory(); |
109 | 109 | }); |
110 | 110 | } |
@@ -116,20 +116,20 @@ discard block |
||
116 | 116 | */ |
117 | 117 | protected function registerResponseBuilders() |
118 | 118 | { |
119 | - $this->app->bind(SuccessResponseBuilder::class, function ($app) { |
|
120 | - $builder = new SuccessResponseBuilder(response(), $app[ResourceFactory::class], $app[Manager::class]); |
|
119 | + $this->app->bind( SuccessResponseBuilder::class, function ( $app ) { |
|
120 | + $builder = new SuccessResponseBuilder( response(), $app[ ResourceFactory::class ], $app[ Manager::class ] ); |
|
121 | 121 | |
122 | - if ($parameter = $app->config->get('responder.load_relations_from_parameter')) { |
|
123 | - $builder->include($this->app[Request::class]->input($parameter, [])); |
|
122 | + if ( $parameter = $app->config->get( 'responder.load_relations_from_parameter' ) ) { |
|
123 | + $builder->include( $this->app[ Request::class ]->input( $parameter, [ ] ) ); |
|
124 | 124 | } |
125 | 125 | |
126 | - return $builder->setIncludeStatusCode($app->config->get('responder.include_status_code')); |
|
126 | + return $builder->setIncludeStatusCode( $app->config->get( 'responder.include_status_code' ) ); |
|
127 | 127 | }); |
128 | 128 | |
129 | - $this->app->bind(ErrorResponseBuilder::class, function ($app) { |
|
130 | - $builder = new ErrorResponseBuilder(response(), $app['translator']); |
|
129 | + $this->app->bind( ErrorResponseBuilder::class, function ( $app ) { |
|
130 | + $builder = new ErrorResponseBuilder( response(), $app[ 'translator' ] ); |
|
131 | 131 | |
132 | - return $builder->setIncludeStatusCode($app->config->get('responder.include_status_code')); |
|
132 | + return $builder->setIncludeStatusCode( $app->config->get( 'responder.include_status_code' ) ); |
|
133 | 133 | }); |
134 | 134 | } |
135 | 135 | |
@@ -140,11 +140,11 @@ discard block |
||
140 | 140 | */ |
141 | 141 | protected function registerAliases() |
142 | 142 | { |
143 | - $this->app->alias(Responder::class, 'responder'); |
|
144 | - $this->app->alias(SuccessResponseBuilder::class, 'responder.success'); |
|
145 | - $this->app->alias(ErrorResponseBuilder::class, 'responder.error'); |
|
146 | - $this->app->alias(Manager::class, 'responder.manager'); |
|
147 | - $this->app->alias(Manager::class, 'responder.serializer'); |
|
143 | + $this->app->alias( Responder::class, 'responder' ); |
|
144 | + $this->app->alias( SuccessResponseBuilder::class, 'responder.success' ); |
|
145 | + $this->app->alias( ErrorResponseBuilder::class, 'responder.error' ); |
|
146 | + $this->app->alias( Manager::class, 'responder.manager' ); |
|
147 | + $this->app->alias( Manager::class, 'responder.serializer' ); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -154,13 +154,13 @@ discard block |
||
154 | 154 | */ |
155 | 155 | protected function bootLaravelApplication() |
156 | 156 | { |
157 | - $this->publishes([ |
|
158 | - __DIR__ . '/../resources/config/responder.php' => config_path('responder.php') |
|
159 | - ], 'config'); |
|
157 | + $this->publishes( [ |
|
158 | + __DIR__ . '/../resources/config/responder.php' => config_path( 'responder.php' ) |
|
159 | + ], 'config' ); |
|
160 | 160 | |
161 | - $this->publishes([ |
|
162 | - __DIR__ . '/../resources/lang/en/errors.php' => base_path('resources/lang/en/errors.php') |
|
163 | - ], 'lang'); |
|
161 | + $this->publishes( [ |
|
162 | + __DIR__ . '/../resources/lang/en/errors.php' => base_path( 'resources/lang/en/errors.php' ) |
|
163 | + ], 'lang' ); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -170,6 +170,6 @@ discard block |
||
170 | 170 | */ |
171 | 171 | protected function bootLumenApplication() |
172 | 172 | { |
173 | - $this->app->configure('responder'); |
|
173 | + $this->app->configure( 'responder' ); |
|
174 | 174 | } |
175 | 175 | } |