@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function register() |
70 | 70 | { |
71 | - $this->app->singleton('apie.config', function () { |
|
71 | + $this->app->singleton('apie.config', function() { |
|
72 | 72 | $config = $this->app->get('config'); |
73 | 73 | return ApieConfigResolver::resolveConfig($config->get('apie') ?? []); |
74 | 74 | }); |
75 | 75 | |
76 | - $this->app->singleton(ApiResourcesInterface::class, function () { |
|
76 | + $this->app->singleton(ApiResourcesInterface::class, function() { |
|
77 | 77 | $config = $this->app->get('apie.config'); |
78 | - if (! empty($config['resources-service'])) { |
|
78 | + if (!empty($config['resources-service'])) { |
|
79 | 79 | return $this->app->get($config['resources-service']); |
80 | 80 | } |
81 | 81 | if ($config['resources'] instanceof ApiResourcesInterface) { |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | return new ApiResources($config['resources']); |
85 | 85 | }); |
86 | 86 | |
87 | - $this->app->singleton(ServiceLibraryFactory::class, function () { |
|
87 | + $this->app->singleton(ServiceLibraryFactory::class, function() { |
|
88 | 88 | return $this->createServiceLibraryFactory(); |
89 | 89 | }); |
90 | 90 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | // OpenApiSpecGenerator: generated an OpenAPI 3.0 spec file from a list of resources. |
97 | 97 | $this->addOpenApiServices(); |
98 | - $this->app->singleton(OpenApiSpecGenerator::class, function () { |
|
98 | + $this->app->singleton(OpenApiSpecGenerator::class, function() { |
|
99 | 99 | $config = $this->app->get('apie.config'); |
100 | 100 | $factory = $this->app->get(ServiceLibraryFactory::class); |
101 | 101 | $baseUrl = $config['base-url'] . $config['api-url']; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | }); |
109 | 109 | |
110 | 110 | // SchemaGenerator: generates a OpenAPI Schema from a api resource class. |
111 | - $this->app->singleton(SchemaGenerator::class, function () { |
|
111 | + $this->app->singleton(SchemaGenerator::class, function() { |
|
112 | 112 | $factory = $this->app->get(ServiceLibraryFactory::class); |
113 | 113 | $service = $factory->getSchemaGenerator(); |
114 | 114 | $service->defineSchemaForResource(UuidInterface::class, new Schema(['type' => 'string', 'format' => 'uuid'])); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | return $service; |
117 | 117 | }); |
118 | 118 | |
119 | - $this->app->singleton(Serializer::class, function () { |
|
119 | + $this->app->singleton(Serializer::class, function() { |
|
120 | 120 | return $this->app->get(ServiceLibraryFactory::class)->getSerializer(); |
121 | 121 | }); |
122 | 122 | $this->app->bind(SerializerInterface::class, Serializer::class); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $this->app->singleton(CamelCaseToSnakeCaseNameConverter::class); |
126 | 126 | $this->app->bind(NameConverterInterface::class, CamelCaseToSnakeCaseNameConverter::class); |
127 | 127 | |
128 | - $this->app->singleton(ApplicationInfoRetriever::class, function () { |
|
128 | + $this->app->singleton(ApplicationInfoRetriever::class, function() { |
|
129 | 129 | $config = $this->app->get('apie.config'); |
130 | 130 | return new ApplicationInfoRetriever( |
131 | 131 | config('app.name'), |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | }); |
137 | 137 | $this->app->singleton(EloquentModelDataLayer::class); |
138 | 138 | $this->app->singleton(DatabaseQueryRetriever::class); |
139 | - $this->app->singleton(FileStorageDataLayer::class, function () { |
|
139 | + $this->app->singleton(FileStorageDataLayer::class, function() { |
|
140 | 140 | return new FileStorageDataLayer( |
141 | 141 | storage_path('app/api-file-storage'), |
142 | 142 | $this->app->get(ServiceLibraryFactory::class)->getPropertyAccessor() |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | }); |
145 | 145 | |
146 | 146 | // ApiResourceFacade: class that calls all the right services with a simple interface. |
147 | - $this->app->singleton(ApiResourceFacade::class, function () { |
|
147 | + $this->app->singleton(ApiResourceFacade::class, function() { |
|
148 | 148 | return $this->app->get(ServiceLibraryFactory::class)->getApiResourceFacade(); |
149 | 149 | }); |
150 | 150 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | private function addOpenApiServices() |
161 | 161 | { |
162 | 162 | // Provides contact information to the OpenAPI spec. |
163 | - $this->app->singleton(Contact::class, function () { |
|
163 | + $this->app->singleton(Contact::class, function() { |
|
164 | 164 | $config = $this->app->get('apie.config'); |
165 | 165 | return new Contact([ |
166 | 166 | 'name' => $config['metadata']['contact-name'], |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | }); |
171 | 171 | |
172 | 172 | // Provides license information to the OpenAPI spec. |
173 | - $this->app->singleton(License::class, function () { |
|
173 | + $this->app->singleton(License::class, function() { |
|
174 | 174 | $config = $this->app->get('apie.config'); |
175 | 175 | return new License( |
176 | 176 | $config['metadata']['license'], |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | }); |
180 | 180 | |
181 | 181 | // Provides OpenAPI info to the OpenAPI spec. |
182 | - $this->app->singleton(Info::class, function () { |
|
182 | + $this->app->singleton(Info::class, function() { |
|
183 | 183 | $config = $this->app->get('apie.config'); |
184 | 184 | return new Info( |
185 | 185 | $config['metadata']['title'], |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | if (!config('app.debug')) { |
209 | 209 | $this->handleSerializerCache($result); |
210 | 210 | } |
211 | - $result->runBeforeInstantiation(function () use (&$result) { |
|
211 | + $result->runBeforeInstantiation(function() use (&$result) { |
|
212 | 212 | $normalizers = [ |
213 | 213 | ]; |
214 | 214 | $taggedNormalizers = $this->app->tagged(NormalizerInterface::class); |
@@ -251,11 +251,11 @@ discard block |
||
251 | 251 | |
252 | 252 | private function addStatusResourceServices() |
253 | 253 | { |
254 | - $this->app->singleton(StatusFromDatabaseRetriever::class, function () { |
|
254 | + $this->app->singleton(StatusFromDatabaseRetriever::class, function() { |
|
255 | 255 | return new StatusFromDatabaseRetriever(config('app.debug')); |
256 | 256 | }); |
257 | 257 | $this->app->tag([StatusFromDatabaseRetriever::class], ['status-check']); |
258 | - $this->app->singleton(StatusCheckRetriever::class, function () { |
|
258 | + $this->app->singleton(StatusCheckRetriever::class, function() { |
|
259 | 259 | return new StatusCheckRetriever($this->app->tagged('status-check')); |
260 | 260 | }); |
261 | 261 | } |