Test Setup Failed
Pull Request — master (#282)
by Antonio Carlos
03:07 queued 01:28
created
src/Support/ResourceChecker.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -92,21 +92,21 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function checkResources($force = false)
94 94
     {
95
-        if (! ($resources = $this->getCachedResources($force))->isEmpty()) {
95
+        if (!($resources = $this->getCachedResources($force))->isEmpty()) {
96 96
             return $resources;
97 97
         }
98 98
 
99
-        if (! $this->allResourcesAreGood()) {
99
+        if (!$this->allResourcesAreGood()) {
100 100
             return $this->resources = collect();
101 101
         }
102 102
 
103 103
         $resources = $this->sortResources(
104 104
             $this->getNonGlobalResources()
105
-                ->each(function ($resource) {
105
+                ->each(function($resource) {
106 106
                     $this->checkResource($resource);
107 107
                 })
108 108
                 ->merge(
109
-                    $this->getGlobalResources()->each(function ($resource) {
109
+                    $this->getGlobalResources()->each(function($resource) {
110 110
                         return $resource->checkGlobal($this->getResources());
111 111
                     })
112 112
                 )
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
                 ? $resource
133 133
                 : $this->getResourceBySlug($resource);
134 134
 
135
-        $checked = $this->cache->remember($resource->slug, function () use (
135
+        $checked = $this->cache->remember($resource->slug, function() use (
136 136
             $resource
137 137
         ) {
138 138
             return $resource->check($this->getCurrentAction(), $this->getCurrentCaller());
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
      */
194 194
     protected function allResourcesAreGood()
195 195
     {
196
-        return ! $this->getResources()
197
-            ->reject(function ($resource) {
198
-                return ! $resource instanceof Resource;
196
+        return !$this->getResources()
197
+            ->reject(function($resource) {
198
+                return !$resource instanceof Resource;
199 199
             })
200 200
             ->isEmpty();
201 201
     }
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
      */
210 210
     protected function getNonGlobalResources()
211 211
     {
212
-        return $this->getResources()->filter(function (Resource $resource) {
213
-            return ! $resource->isGlobal;
212
+        return $this->getResources()->filter(function(Resource $resource) {
213
+            return !$resource->isGlobal;
214 214
         });
215 215
     }
216 216
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
      */
224 224
     protected function getGlobalResources()
225 225
     {
226
-        return $this->getResources()->filter(function (Resource $resource) {
226
+        return $this->getResources()->filter(function(Resource $resource) {
227 227
             return $resource->isGlobal;
228 228
         });
229 229
     }
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
             ? $exception->getMessage()
257 257
             : static::UNKNOWN_ERROR;
258 258
 
259
-        if (! isset($resourceChecker)) {
259
+        if (!isset($resourceChecker)) {
260 260
             return [
261 261
                 null,
262 262
                 [
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
     {
325 325
         if (is_null($this->resources) || $this->resources->isEmpty()) {
326 326
             $this->resources = $this->resourceLoader->loadResources()->map(
327
-                function ($resource) {
328
-                    return $this->handleExceptions(function () use ($resource) {
327
+                function($resource) {
328
+                    return $this->handleExceptions(function() use ($resource) {
329 329
                         return $this->makeResource($resource);
330 330
                     });
331 331
                 }
@@ -361,8 +361,8 @@  discard block
 block discarded – undo
361 361
     protected function sortResources($resources)
362 362
     {
363 363
         if ($sortBy = config('health.sort_by')) {
364
-            return $resources->sortBy(function ($resource) use ($sortBy) {
365
-                return $this->handleExceptions(function () use (
364
+            return $resources->sortBy(function($resource) use ($sortBy) {
365
+                return $this->handleExceptions(function() use (
366 366
                     $resource,
367 367
                     $sortBy
368 368
                 ) {
Please login to merge, or discard this patch.
src/Checkers/HealthPanel.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
             foreach ($resources as $url) {
49 49
                 [$healthy, $message] = $this->checkHealthPanel($url);
50 50
 
51
-                if (! $healthy) {
51
+                if (!$healthy) {
52 52
                     return $this->makeResult(false, $message);
53 53
                 }
54 54
             }
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     {
71 71
         $urls = $this->target->urls;
72 72
 
73
-        if (! is_a($urls, Collection::class)) {
73
+        if (!is_a($urls, Collection::class)) {
74 74
             $urls = collect($urls);
75 75
         }
76 76
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
         foreach ($resources as $resource) {
112 112
             foreach ($resource['targets'] as $target) {
113
-                if (! $target['result']['healthy']) {
113
+                if (!$target['result']['healthy']) {
114 114
                     $messages[] = $resource['name'];
115 115
                 }
116 116
             }
Please login to merge, or discard this patch.
src/ServiceProvider.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 
139 139
         $cache = call_user_func($this->cacheClosure);
140 140
 
141
-        $this->healthServiceClosure = function () use (
141
+        $this->healthServiceClosure = function() use (
142 142
             $resourceChecker,
143 143
             $cache
144 144
         ) {
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
      */
171 171
     private function getCacheClosure()
172 172
     {
173
-        $cacheClosure = function () {
173
+        $cacheClosure = function() {
174 174
             return new Cache();
175 175
         };
176 176
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
      */
187 187
     private function getResourceCheckerClosure($resourceLoader, $cache)
188 188
     {
189
-        $resourceCheckerInstance = function () use ($resourceLoader, $cache) {
189
+        $resourceCheckerInstance = function() use ($resourceLoader, $cache) {
190 190
             return new ResourceChecker($resourceLoader, $cache);
191 191
         };
192 192
 
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
 
266 266
     private function registerResourcesRoutes()
267 267
     {
268
-        collect($this->resourceLoader->getResources())->each(function ($item) {
268
+        collect($this->resourceLoader->getResources())->each(function($item) {
269 269
             if (isset($item['routes'])) {
270
-                collect($item['routes'])->each(function ($route, $key) {
270
+                collect($item['routes'])->each(function($route, $key) {
271 271
                     $this->registerRoute($route, $key);
272 272
                 });
273 273
             }
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
             return;
303 303
         }
304 304
 
305
-        collect($routes = $this->getRoutes())->each(function ($route) {
305
+        collect($routes = $this->getRoutes())->each(function($route) {
306 306
             $this->registerRoute($route);
307 307
         });
308 308
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 
328 328
         $this->app->singleton(
329 329
             'pragmarx.health.commands',
330
-            function () {
330
+            function() {
331 331
                 return $this->instantiateCommands();
332 332
             }
333 333
         );
Please login to merge, or discard this patch.
src/Support/Resource.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -206,7 +206,7 @@
 block discarded – undo
206 206
     public function check($action = 'resource', $caller = 'console')
207 207
     {
208 208
         $this->setCurrentAction($action)
209
-             ->setCurrentCaller($caller)
209
+                ->setCurrentCaller($caller)
210 210
             ->targets->each(function (
211 211
                 Target $target
212 212
             ) {
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -169,12 +169,12 @@  discard block
 block discarded – undo
169 169
         $current = collect();
170 170
 
171 171
         $targets = $targets
172
-            ->map(function (Collection $targetList) {
173
-                return $targetList->map(function ($target, $name) {
172
+            ->map(function(Collection $targetList) {
173
+                return $targetList->map(function($target, $name) {
174 174
                     return Target::factory($this, $target, $name);
175 175
                 });
176 176
             })
177
-            ->reduce(function ($current, $targetList) {
177
+            ->reduce(function($current, $targetList) {
178 178
                 foreach ($targetList as $target) {
179 179
                     $current[] = $target;
180 180
                 }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
     {
208 208
         $this->setCurrentAction($action)
209 209
              ->setCurrentCaller($caller)
210
-            ->targets->each(function (
210
+            ->targets->each(function(
211 211
                 Target $target
212 212
             ) {
213 213
                 $target->check($target);
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
      */
237 237
     public function isHealthy()
238 238
     {
239
-        return $this->targets->reduce(function ($carry, $target) {
239
+        return $this->targets->reduce(function($carry, $target) {
240 240
             return $carry && $target->result->healthy;
241 241
         }, true);
242 242
     }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
     public function getStatus()
250 250
     {
251 251
         $exitCode = Commands::EXIT_CODES[result::OK];
252
-        $this->targets->each(function ($target) use (&$exitCode) {
252
+        $this->targets->each(function($target) use (&$exitCode) {
253 253
             // Handles exit codes based on the result's status.
254 254
             $thisStatus = $target->result->getStatus();
255 255
             $thisExitCode = Commands::EXIT_CODES[$thisStatus];
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 
265 265
     protected function keysToCamel($array)
266 266
     {
267
-        return collect($array)->mapWithKeys(function ($item, $key) {
267
+        return collect($array)->mapWithKeys(function($item, $key) {
268 268
             return [Str::camel($key) => $item];
269 269
         });
270 270
     }
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
      */
287 287
     protected function sendNotifications()
288 288
     {
289
-        return collect(config('health.notifications.channels'))->each(function (
289
+        return collect(config('health.notifications.channels'))->each(function(
290 290
             $channel
291 291
         ) {
292 292
             try {
@@ -305,9 +305,9 @@  discard block
 block discarded – undo
305 305
     protected function canNotify()
306 306
     {
307 307
         return
308
-            ! $this->notified &&
308
+            !$this->notified &&
309 309
             $this->notificationsAreEnabled() &&
310
-            ! $this->isHealthy();
310
+            !$this->isHealthy();
311 311
     }
312 312
 
313 313
     /**
Please login to merge, or discard this patch.