Passed
Push — master ( 80001a...1201cf )
by
unknown
03:47
created
src/Providers/ApieConfigResolver.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
                 ->setAllowedTypes('metadata', 'string[]')
46 46
                 ->setAllowedTypes('resource-config', [ApiResource::class . '[]', 'array[]'])
47 47
                 ->setAllowedTypes('exception-mapping', 'int[]');
48
-            $resolver->setDefault('metadata', function (OptionsResolver $metadataResolver) use (&$defaults) {
48
+            $resolver->setDefault('metadata', function(OptionsResolver $metadataResolver) use (&$defaults) {
49 49
                 $metadataResolver->setDefaults($defaults['metadata']);
50 50
 
51
-                $urlNormalizer = function (Options $options, $value) {
51
+                $urlNormalizer = function(Options $options, $value) {
52 52
                     if (empty($value)) {
53 53
                         return '';
54 54
                     }
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
                 $metadataResolver->setNormalizer('license-url', $urlNormalizer);
59 59
                 $metadataResolver->setNormalizer('contact-url', $urlNormalizer);
60 60
             });
61
-            $resolver->setNormalizer('resource-config', function (Options $options, $value) {
62
-                return array_map(function ($field) {
61
+            $resolver->setNormalizer('resource-config', function(Options $options, $value) {
62
+                return array_map(function($field) {
63 63
                     return $field instanceof ApiResource ? $field : ApiResource::createFromArray($field);
64 64
                 }, $value);
65 65
             });
66
-            $resolver->setNormalizer('exception-mapping', function (Options $options, $value) {
66
+            $resolver->setNormalizer('exception-mapping', function(Options $options, $value) {
67 67
                 ApieConfigResolver::addExceptionsForExceptionMapping($value);
68 68
                 return $value;
69 69
             });
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     private static function urlNormalize($value)
89 89
     {
90 90
         if ('http://' !== substr($value, 0, 7) && 'https://' !== substr($value, 0, 8)) {
91
-            $value = 'https://'.$value;
91
+            $value = 'https://' . $value;
92 92
         }
93 93
         $parsedUrl = parse_url($value);
94 94
         if (empty($parsedUrl) || !in_array($parsedUrl['scheme'], ['http', 'https']) || !filter_var($value, FILTER_VALIDATE_URL)) {
Please login to merge, or discard this patch.
src/Providers/ApiResourceServiceProvider.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public function register()
68 68
     {
69
-        $this->app->singleton('apie.config', function () {
69
+        $this->app->singleton('apie.config', function() {
70 70
             $config = $this->app->get('config');
71 71
             return ApieConfigResolver::resolveConfig($config->get('apie') ?? []);
72 72
         });
73 73
 
74
-        $this->app->singleton(ApiResourcesInterface::class, function () {
74
+        $this->app->singleton(ApiResourcesInterface::class, function() {
75 75
             $config = $this->app->get('apie.config');
76
-            if (! empty($config['resources-service'])) {
76
+            if (!empty($config['resources-service'])) {
77 77
                 return $this->app->get($config['resources-service']);
78 78
             }
79 79
             if ($config['resources'] instanceof ApiResourcesInterface) {
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             return new ApiResources($config['resources']);
83 83
         });
84 84
 
85
-        $this->app->singleton(ServiceLibraryFactory::class, function () {
85
+        $this->app->singleton(ServiceLibraryFactory::class, function() {
86 86
             return $this->createServiceLibraryFactory();
87 87
         });
88 88
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
         // OpenApiSpecGenerator: generated an OpenAPI 3.0 spec file from a list of resources.
95 95
         $this->addOpenApiServices();
96
-        $this->app->singleton(OpenApiSpecGenerator::class, function () {
96
+        $this->app->singleton(OpenApiSpecGenerator::class, function() {
97 97
             $config = $this->app->get('apie.config');
98 98
             $factory = $this->app->get(ServiceLibraryFactory::class);
99 99
             $baseUrl = $config['base-url'] . $config['api-url'];
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         });
107 107
 
108 108
         // SchemaGenerator: generates a OpenAPI Schema from a api resource class.
109
-        $this->app->singleton(SchemaGenerator::class, function () {
109
+        $this->app->singleton(SchemaGenerator::class, function() {
110 110
             $factory = $this->app->get(ServiceLibraryFactory::class);
111 111
             $service = $factory->getSchemaGenerator();
112 112
             $service->defineSchemaForResource(UuidInterface::class, new Schema(['type' => 'string', 'format' => 'uuid']));
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
             return $service;
115 115
         });
116 116
 
117
-        $this->app->singleton(Serializer::class, function () {
117
+        $this->app->singleton(Serializer::class, function() {
118 118
             return $this->app->get(ServiceLibraryFactory::class)->getSerializer();
119 119
         });
120 120
         $this->app->bind(SerializerInterface::class, Serializer::class);
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         $this->app->singleton(CamelCaseToSnakeCaseNameConverter::class);
124 124
         $this->app->bind(NameConverterInterface::class, CamelCaseToSnakeCaseNameConverter::class);
125 125
 
126
-        $this->app->singleton(ApplicationInfoRetriever::class, function () {
126
+        $this->app->singleton(ApplicationInfoRetriever::class, function() {
127 127
             $config = $this->app->get('apie.config');
128 128
             return new ApplicationInfoRetriever(
129 129
                 config('app.name'),
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         });
135 135
         $this->app->singleton(EloquentModelDataLayer::class);
136 136
         $this->app->singleton(DatabaseQueryRetriever::class);
137
-        $this->app->singleton(FileStorageDataLayer::class, function () {
137
+        $this->app->singleton(FileStorageDataLayer::class, function() {
138 138
             return new FileStorageDataLayer(
139 139
                 storage_path('app/api-file-storage'),
140 140
                 $this->app->get(ServiceLibraryFactory::class)->getPropertyAccessor()
@@ -142,10 +142,10 @@  discard block
 block discarded – undo
142 142
         });
143 143
 
144 144
         // ApiResourceFacade: class that calls all the right services with a simple interface.
145
-        $this->app->singleton(ApiResourceFacade::class, function () {
145
+        $this->app->singleton(ApiResourceFacade::class, function() {
146 146
             return $this->app->get(ServiceLibraryFactory::class)->getApiResourceFacade();
147 147
         });
148
-        $this->app->singleton(ApieExceptionToResponse::class, function () {
148
+        $this->app->singleton(ApieExceptionToResponse::class, function() {
149 149
             $mapping = $this->app->get('apie.config')['exception-mapping'];
150 150
             return new ApieExceptionToResponse(resolve(HttpFoundationFactory::class), $mapping);
151 151
         });
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
     private function addOpenApiServices()
163 163
     {
164 164
         // Provides contact information to the OpenAPI spec.
165
-        $this->app->singleton(Contact::class, function () {
165
+        $this->app->singleton(Contact::class, function() {
166 166
             $config = $this->app->get('apie.config');
167 167
             return new Contact([
168 168
                 'name'  => $config['metadata']['contact-name'],
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
         });
173 173
 
174 174
         // Provides license information to the OpenAPI spec.
175
-        $this->app->singleton(License::class, function () {
175
+        $this->app->singleton(License::class, function() {
176 176
             $config = $this->app->get('apie.config');
177 177
             return new License(
178 178
                 $config['metadata']['license'],
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         });
182 182
 
183 183
         // Provides OpenAPI info to the OpenAPI spec.
184
-        $this->app->singleton(Info::class, function () {
184
+        $this->app->singleton(Info::class, function() {
185 185
             $config = $this->app->get('apie.config');
186 186
             return new Info(
187 187
                 $config['metadata']['title'],
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
         if (!config('app.debug')) {
211 211
             $this->handleSerializerCache($result);
212 212
         }
213
-        $result->runBeforeInstantiation(function () use (&$result) {
213
+        $result->runBeforeInstantiation(function() use (&$result) {
214 214
             $normalizers = [
215 215
             ];
216 216
             $taggedNormalizers = $this->app->tagged(NormalizerInterface::class);
@@ -253,11 +253,11 @@  discard block
 block discarded – undo
253 253
 
254 254
     private function addStatusResourceServices()
255 255
     {
256
-        $this->app->singleton(StatusFromDatabaseRetriever::class, function () {
256
+        $this->app->singleton(StatusFromDatabaseRetriever::class, function() {
257 257
             return new StatusFromDatabaseRetriever(config('app.debug'));
258 258
         });
259 259
         $this->app->tag([StatusFromDatabaseRetriever::class], ['status-check']);
260
-        $this->app->singleton(StatusCheckRetriever::class, function () {
260
+        $this->app->singleton(StatusCheckRetriever::class, function() {
261 261
             return new StatusCheckRetriever($this->app->tagged('status-check'));
262 262
         });
263 263
     }
Please login to merge, or discard this patch.