Passed
Branch master (26639e)
by Antonio Carlos
10:04 queued 04:30
created
src/Commands.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     {
41 41
         $columns = ['Resource', 'State', 'Message'];
42 42
 
43
-        $rows = $this->healthService->health()->map(function ($resource) {
43
+        $rows = $this->healthService->health()->map(function($resource) {
44 44
             return [
45 45
                 $resource['name'],
46 46
                 $resource['health']['healthy']
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     {
58 58
         $checker = $this->healthService->getSilentChecker();
59 59
 
60
-        $errors = $checker()->where('is_global', false)->reduce(function ($carry, $item) {
60
+        $errors = $checker()->where('is_global', false)->reduce(function($carry, $item) {
61 61
             return $carry + ($item['health']['healthy'] ? 0 : 1);
62 62
         }, 0);
63 63
 
@@ -77,14 +77,14 @@  discard block
 block discarded – undo
77 77
     {
78 78
         $yaml = new Yaml();
79 79
 
80
-        collect(config('health.resources'))->each(function ($resource, $key) use ($command, $yaml) {
80
+        collect(config('health.resources'))->each(function($resource, $key) use ($command, $yaml) {
81 81
             $path = config('health.resources_location.path');
82 82
 
83 83
             $resource['column_size'] = (int) $resource['columnSize'];
84 84
 
85 85
             unset($resource['columnSize']);
86 86
 
87
-            if (! file_exists($path)) {
87
+            if (!file_exists($path)) {
88 88
                 mkdir($path, 0660, true);
89 89
             }
90 90
 
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
     {
101 101
         $yaml = new Yaml();
102 102
 
103
-        $yaml->loadYamlFromDir(package_resources_dir(), false)->each(function ($value, $key) use ($command) {
104
-            if (! file_exists($path = config('health.resources_location.path'))) {
103
+        $yaml->loadYamlFromDir(package_resources_dir(), false)->each(function($value, $key) use ($command) {
104
+            if (!file_exists($path = config('health.resources_location.path'))) {
105 105
                 mkdir($path, 0660, true);
106 106
             }
107 107
 
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
      * Format input to textual table.
121 121
      *
122 122
      * @param Command|null $command
123
-     * @param $columns
123
+     * @param string[] $columns
124 124
      * @param  \Illuminate\Contracts\Support\Arrayable|array $rows
125 125
      */
126 126
     private function table($command, $columns, $rows)
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
      * Write a string as information output.
135 135
      *
136 136
      * @param Command|null $command
137
-     * @param $string
137
+     * @param string $string
138 138
      */
139 139
     private function info($command, $string)
140 140
     {
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
      * Write a string as information output.
148 148
      *
149 149
      * @param Command|null $command
150
-     * @param $string
150
+     * @param string $string
151 151
      */
152 152
     private function error($command, $string)
153 153
     {
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      * Write a string as information output.
161 161
      *
162 162
      * @param Command|null $command
163
-     * @param $string
163
+     * @param string $string
164 164
      */
165 165
     private function warn($command, $string)
166 166
     {
Please login to merge, or discard this patch.
src/Support/Yaml.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
      *
12 12
      * @param $directory
13 13
      * @param bool $parseYaml
14
-     * @return static
14
+     * @return \Illuminate\Support\Collection
15 15
      */
16 16
     public function loadYamlFromDir($directory, $parseYaml = true)
17 17
     {
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     /**
26 26
      * Parse a yaml file.
27 27
      *
28
-     * @param $contents
28
+     * @param string $contents
29 29
      * @return mixed
30 30
      */
31 31
     private function parseFile($contents)
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      * Replace contents.
38 38
      *
39 39
      * @param $contents
40
-     * @return mixed
40
+     * @return string
41 41
      */
42 42
     private function replaceContents($contents)
43 43
     {
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     /**
56 56
      * Resolve variable.
57 57
      *
58
-     * @param $key
58
+     * @param string $key
59 59
      * @return string
60 60
      */
61 61
     private function resolveVariable($key)
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     /**
73 73
      * Execute function.
74 74
      *
75
-     * @param $string
75
+     * @param string $string
76 76
      * @return mixed
77 77
      */
78 78
     private function executeFunction($string)
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,13 +15,13 @@
 block discarded – undo
15 15
      */
16 16
     public function loadYamlFromDir($directory, $parseYaml = true)
17 17
     {
18
-        if (! file_exists($directory)) {
18
+        if (!file_exists($directory)) {
19 19
             return collect([]);
20 20
         }
21 21
 
22
-        return collect(scandir($directory) ?: [])->reject(function ($item) {
23
-            return is_dir($item) || ! ends_with($item, '.yml');
24
-        })->mapWithKeys(function ($file) use ($directory, $parseYaml) {
22
+        return collect(scandir($directory) ?: [])->reject(function($item) {
23
+            return is_dir($item) || !ends_with($item, '.yml');
24
+        })->mapWithKeys(function($file) use ($directory, $parseYaml) {
25 25
             return [$file => $this->loadFile($directory, $file, $parseYaml)];
26 26
         });
27 27
     }
Please login to merge, or discard this patch.
src/Support/ResourceLoader.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
     private function getEnabledResources($resources)
34 34
     {
35 35
         if (is_array($keys = config($configKey = 'health.resources_enabled'))) {
36
-            return collect($resources)->reject(function ($value, $key) use ($keys) {
37
-                return ! in_array($key, $keys);
36
+            return collect($resources)->reject(function($value, $key) use ($keys) {
37
+                return !in_array($key, $keys);
38 38
             });
39 39
         }
40 40
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      */
71 71
     private function loadArray()
72 72
     {
73
-        return collect(config('health.resources'))->mapWithKeys(function ($value, $key) {
73
+        return collect(config('health.resources'))->mapWithKeys(function($value, $key) {
74 74
             return [studly_case($key) => $value];
75 75
         });
76 76
     }
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
     {
85 85
         $local = $this->yaml->loadYamlFromDir(config('health.resources_location.path'));
86 86
 
87
-        return $this->yaml->loadYamlFromDir(package_resources_dir())->reject(function ($item, $key) use ($local) {
87
+        return $this->yaml->loadYamlFromDir(package_resources_dir())->reject(function($item, $key) use ($local) {
88 88
             return $local->keys()->has($key);
89
-        })->merge($local)->mapWithKeys(function ($value, $key) {
89
+        })->merge($local)->mapWithKeys(function($value, $key) {
90 90
             return [$this->removeExtension($key) => $value];
91 91
         });
92 92
     }
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      */
145 145
     protected function makeResourcesCollection()
146 146
     {
147
-        return collect($this->load())->map(function ($item, $key) {
147
+        return collect($this->load())->map(function($item, $key) {
148 148
             $item['slug'] = $key;
149 149
 
150 150
             $item['name'] = Str::studly($key);
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
      */
190 190
     private function sanitizeResources($resources)
191 191
     {
192
-        return $resources->map(function ($resource) {
193
-            return collect($resource)->mapWithKeys(function ($value, $key) {
192
+        return $resources->map(function($resource) {
193
+            return collect($resource)->mapWithKeys(function($value, $key) {
194 194
                 return [$this->sanitizeKey($key) => $value];
195 195
             });
196 196
         });
@@ -205,10 +205,10 @@  discard block
 block discarded – undo
205 205
     protected function sortResources($resources)
206 206
     {
207 207
         if ($sortBy = config('health.sort_by')) {
208
-            $resources = $resources->sortBy(function ($item) use ($sortBy) {
208
+            $resources = $resources->sortBy(function($item) use ($sortBy) {
209 209
                 return $item['is_global']
210
-                    ? 0 .$item[$sortBy]
211
-                    : 1 .$item[$sortBy];
210
+                    ? 0.$item[$sortBy]
211
+                    : 1.$item[$sortBy];
212 212
             });
213 213
 
214 214
             return $resources;
Please login to merge, or discard this patch.
src/Support/helpers.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
      * Check if string is absolute path.
57 57
      *
58 58
      * @param $path
59
-     * @return string
59
+     * @return boolean
60 60
      */
61 61
     function is_absolute_path($path)
62 62
     {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 use PragmaRX\Health\Service;
4 4
 
5
-if (! function_exists('instantiate')) {
5
+if (!function_exists('instantiate')) {
6 6
     /**
7 7
      * Instantiate a class.
8 8
      *
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     }
23 23
 }
24 24
 
25
-if (! function_exists('package_dir')) {
25
+if (!function_exists('package_dir')) {
26 26
     /**
27 27
      * Get the package root directory.
28 28
      *
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     }
37 37
 }
38 38
 
39
-if (! function_exists('package_resources_dir')) {
39
+if (!function_exists('package_resources_dir')) {
40 40
     /**
41 41
      * Get package resources directory.
42 42
      *
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     }
53 53
 }
54 54
 
55
-if (! function_exists('is_absolute_path')) {
55
+if (!function_exists('is_absolute_path')) {
56 56
     /**
57 57
      * Check if string is absolute path.
58 58
      *
Please login to merge, or discard this patch.
src/Checkers/DocusignChecker.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
             return $this->makeResult(false, $this->resource['not_installed_message']);
20 20
         }
21 21
 
22
-        if (! $this->login()) {
22
+        if (!$this->login()) {
23 23
             throw new DomainException('Unable to authenticate to the DocuSign Api');
24 24
         }
25 25
 
Please login to merge, or discard this patch.
tests/PhpUnit/Service/ServiceTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 
89 89
     public function testResourcesWhereChecked()
90 90
     {
91
-        $healthCount = $this->resources->reduce(function ($carry, $item) {
91
+        $healthCount = $this->resources->reduce(function($carry, $item) {
92 92
             return $carry + (isset($item['health']['healthy'])
93 93
                     ? 1
94 94
                     : 0);
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         $this->assertEquals(count(static::ALL_RESOURCES), $healthCount);
98 98
 
99 99
         $failing = $this->resources
100
-            ->filter(function ($item) {
100
+            ->filter(function($item) {
101 101
                 return $item['health']['healthy'];
102 102
             });
103 103
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     {
124 124
         $this->assertEquals(
125 125
             static::ALL_RESOURCES,
126
-            $this->resources->keys()->map(function ($value) {
126
+            $this->resources->keys()->map(function($value) {
127 127
                 return strtolower($value);
128 128
             })->toArray()
129 129
         );
Please login to merge, or discard this patch.
src/ServiceProvider.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     /**
143 143
      * Get the resource checker closure for instantiation.
144 144
      *
145
-     * @param $resourceLoader
145
+     * @param ResourceLoader $resourceLoader
146 146
      * @param $cache
147 147
      * @return \Closure
148 148
      */
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
     /**
355 355
      * Get the services provided by the provider.
356 356
      *
357
-     * @return array
357
+     * @return string[]
358 358
      */
359 359
     public function provides()
360 360
     {
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
         $cache = call_user_func($this->cacheClosure);
98 98
 
99
-        $this->healthServiceClosure = function () use ($resourceChecker, $cache) {
99
+        $this->healthServiceClosure = function() use ($resourceChecker, $cache) {
100 100
             return $this->instantiateService($resourceChecker, $cache);
101 101
         };
102 102
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      */
123 123
     private function getCacheClosure()
124 124
     {
125
-        $cacheClosure = function () {
125
+        $cacheClosure = function() {
126 126
             return new Cache();
127 127
         };
128 128
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      */
149 149
     private function getResourceCheckerClosure($resourceLoader, $cache)
150 150
     {
151
-        $resourceCheckerInstance = function () use ($resourceLoader, $cache) {
151
+        $resourceCheckerInstance = function() use ($resourceLoader, $cache) {
152 152
             return new ResourceChecker($resourceLoader, $cache);
153 153
         };
154 154
 
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
      */
163 163
     private function getRouter()
164 164
     {
165
-        if (! $this->router) {
165
+        if (!$this->router) {
166 166
             $this->router = $this->app->router;
167 167
 
168
-            if (! $this->router instanceof Router) {
168
+            if (!$this->router instanceof Router) {
169 169
                 $this->router = app()->router;
170 170
             }
171 171
         }
@@ -241,9 +241,9 @@  discard block
 block discarded – undo
241 241
 
242 242
     private function registerResourcesRoutes()
243 243
     {
244
-        collect(config('health.resources'))->each(function ($item) {
244
+        collect(config('health.resources'))->each(function($item) {
245 245
             if (isset($item['routes'])) {
246
-                collect($item['routes'])->each(function ($route, $key) {
246
+                collect($item['routes'])->each(function($route, $key) {
247 247
                     $this->registerRoute($route, $key);
248 248
                 });
249 249
             }
@@ -257,19 +257,19 @@  discard block
 block discarded – undo
257 257
     {
258 258
         $commands = $this->commands;
259 259
 
260
-        Artisan::command('health:panel', function () use ($commands) {
260
+        Artisan::command('health:panel', function() use ($commands) {
261 261
             $commands->panel($this);
262 262
         })->describe('Show all resources and their current health states.');
263 263
 
264
-        Artisan::command('health:check', function () use ($commands) {
264
+        Artisan::command('health:check', function() use ($commands) {
265 265
             $commands->check($this);
266 266
         })->describe('Check resources health and send error notifications.');
267 267
 
268
-        Artisan::command('health:export', function () use ($commands) {
268
+        Artisan::command('health:export', function() use ($commands) {
269 269
             $commands->export($this);
270 270
         })->describe('Export "array" resources to .yml files');
271 271
 
272
-        Artisan::command('health:publish', function () use ($commands) {
272
+        Artisan::command('health:publish', function() use ($commands) {
273 273
             $commands->publish($this);
274 274
         })->describe('Publish all .yml resouces files to config directory.');
275 275
     }
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
      */
304 304
     private function registerRoutes()
305 305
     {
306
-        collect($routes = $this->getRoutes())->each(function ($route) {
306
+        collect($routes = $this->getRoutes())->each(function($route) {
307 307
             $this->registerRoute($route);
308 308
         });
309 309
 
Please login to merge, or discard this patch.
src/Service.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
      */
68 68
     public function getSilentChecker()
69 69
     {
70
-        return function () {
70
+        return function() {
71 71
             $this->cache->flush();
72 72
 
73 73
             return $this->checkResources();
Please login to merge, or discard this patch.