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