@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | foreach ($resources as $url) { |
29 | 29 | [$healthy, $message] = $this->checkCertificate($url); |
30 | 30 | |
31 | - if (! $healthy) { |
|
31 | + if (!$healthy) { |
|
32 | 32 | return $this->makeResult(false, $message); |
33 | 33 | } |
34 | 34 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | 'php' => $this->checkCertificateWithPhp($host), |
105 | 105 | ]) |
106 | - ->filter(function ($result) { |
|
106 | + ->filter(function($result) { |
|
107 | 107 | return $result[0] === false; |
108 | 108 | }) |
109 | 109 | ->first(); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | $result = collect($output) |
123 | 123 | ->filter( |
124 | - function ($line) { |
|
124 | + function($line) { |
|
125 | 125 | return Str::contains( |
126 | 126 | $line, |
127 | 127 | $this->target->resource->verifyString |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function getSilentChecker() |
90 | 90 | { |
91 | - return function () { |
|
91 | + return function() { |
|
92 | 92 | return $this->checkResources(); |
93 | 93 | }; |
94 | 94 | } |
@@ -149,14 +149,14 @@ discard block |
||
149 | 149 | public function string(?string $filters = '') |
150 | 150 | { |
151 | 151 | // If filters are required, return "" for results that should not be included. |
152 | - if (! empty($filters)) { |
|
152 | + if (!empty($filters)) { |
|
153 | 153 | $filters = explode(',', strtolower($filters)); |
154 | 154 | } |
155 | 155 | |
156 | - return collect($this->health())->reduce(function ($current, $resource) use ($filters) { |
|
156 | + return collect($this->health())->reduce(function($current, $resource) use ($filters) { |
|
157 | 157 | $resourceStatus = $resource->getStatus(); |
158 | 158 | |
159 | - if (! empty($filters) && ! in_array(strtolower($resourceStatus), $filters)) { |
|
159 | + if (!empty($filters) && !in_array(strtolower($resourceStatus), $filters)) { |
|
160 | 160 | return $current; |
161 | 161 | } |
162 | 162 |
@@ -72,7 +72,7 @@ |
||
72 | 72 | $msg = "{$resource->name} is running above the warning threshold"; |
73 | 73 | break; |
74 | 74 | case Result::CRITICAL: |
75 | - if (! empty($resource->errorMessage)) { |
|
75 | + if (!empty($resource->errorMessage)) { |
|
76 | 76 | $msg = "{$resource->errorMessage}"; |
77 | 77 | } else { |
78 | 78 | $msg = "{$resource->name} service is failing or has reached the critical threshold"; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $exitCode = self::EXIT_CODES[result::OK]; |
83 | 83 | |
84 | 84 | $rows = $this->getTargetsFomResources($this->healthService->health()) |
85 | - ->map(function ($target) use (&$exitCode) { |
|
85 | + ->map(function($target) use (&$exitCode) { |
|
86 | 86 | // Handles exit codes based on the result's status. |
87 | 87 | $thisStatus = $target->result->getStatus(); |
88 | 88 | $thisExitCode = self::EXIT_CODES[$thisStatus]; |
@@ -122,9 +122,9 @@ discard block |
||
122 | 122 | |
123 | 123 | $exitCode = self::EXIT_CODES[result::OK]; |
124 | 124 | |
125 | - $errors = $this->getTargetsFomResources($checker()->filter(function ($resource) { |
|
126 | - return ! $resource->isGlobal; |
|
127 | - }))->reduce(function ($carry, $target) use (&$exitCode) { |
|
125 | + $errors = $this->getTargetsFomResources($checker()->filter(function($resource) { |
|
126 | + return !$resource->isGlobal; |
|
127 | + }))->reduce(function($carry, $target) use (&$exitCode) { |
|
128 | 128 | // Handles exit codes based on the result's status. |
129 | 129 | $thisStatus = $target->result->getStatus(); |
130 | 130 | $thisExitCode = self::EXIT_CODES[$thisStatus]; |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | */ |
213 | 213 | protected function getResourceTotalTime($resource) |
214 | 214 | { |
215 | - if (! method_exists($resource->checker, 'getTotalTime')) { |
|
215 | + if (!method_exists($resource->checker, 'getTotalTime')) { |
|
216 | 216 | dd($resource); |
217 | 217 | } |
218 | 218 |
@@ -32,7 +32,7 @@ |
||
32 | 32 | |
33 | 33 | public function getCommand() |
34 | 34 | { |
35 | - if (! file_exists($executable = $this->target->resource->executable)) { |
|
35 | + if (!file_exists($executable = $this->target->resource->executable)) { |
|
36 | 36 | throw new Exception("The security checker executable was not found: $executable"); |
37 | 37 | } |
38 | 38 |
@@ -138,7 +138,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | ); |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | private function getResources($force = false) |
20 | 20 | { |
21 | - if ($force || ! $this->resources) { |
|
21 | + if ($force || !$this->resources) { |
|
22 | 22 | $this->resources = $this->service->checkResources($force); |
23 | 23 | } |
24 | 24 | |
@@ -104,12 +104,12 @@ discard block |
||
104 | 104 | |
105 | 105 | public function assertCheckedResources($resources) |
106 | 106 | { |
107 | - $healthy = $resources->filter(function ($resource) { |
|
107 | + $healthy = $resources->filter(function($resource) { |
|
108 | 108 | return $resource->isHealthy(); |
109 | 109 | })->keys(); |
110 | 110 | |
111 | - $failing = $resources->filter(function ($resource) { |
|
112 | - return ! $resource->isHealthy(); |
|
111 | + $failing = $resources->filter(function($resource) { |
|
112 | + return !$resource->isHealthy(); |
|
113 | 113 | })->keys(); |
114 | 114 | |
115 | 115 | $this->assertGreaterThanOrEqual(self::RESOURCES_HEALTHY_EVERYWHERE, $failing->count()); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | { |
139 | 139 | $this->assertEquals( |
140 | 140 | collect(static::ALL_RESOURCES) |
141 | - ->map(function ($value) { |
|
141 | + ->map(function($value) { |
|
142 | 142 | return strtolower($value); |
143 | 143 | }) |
144 | 144 | ->sort() |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | ->toArray(), |
147 | 147 | $this->getResources() |
148 | 148 | ->keys() |
149 | - ->map(function ($value) { |
|
149 | + ->map(function($value) { |
|
150 | 150 | return strtolower($value); |
151 | 151 | }) |
152 | 152 | ->sort() |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | (new Commands($this->service))->$command(); |
164 | 164 | } |
165 | 165 | |
166 | - $this->assertFalse(! true); |
|
166 | + $this->assertFalse(!true); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | public function testController() |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | } |
214 | 214 | |
215 | 215 | foreach ($subset as $value) { |
216 | - if (! $array->contains($value)) { |
|
216 | + if (!$array->contains($value)) { |
|
217 | 217 | return false; |
218 | 218 | } |
219 | 219 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | */ |
18 | 18 | public function handle($request, $next, ...$guards) |
19 | 19 | { |
20 | - if (! (new LocallyProtectedService())->check($request)) { |
|
20 | + if (!(new LocallyProtectedService())->check($request)) { |
|
21 | 21 | abort(403, 'Forbidden'); |
22 | 22 | } |
23 | 23 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | { |
22 | 22 | $this->requestServerVars(); |
23 | 23 | |
24 | - collect($this->target->config['vars'])->each(function ($var) { |
|
24 | + collect($this->target->config['vars'])->each(function($var) { |
|
25 | 25 | $this->checkVar($var); |
26 | 26 | }); |
27 | 27 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | $expected = $var['value']; |
65 | 65 | |
66 | - if (! $this->compare($var, $expected, $got)) { |
|
66 | + if (!$this->compare($var, $expected, $got)) { |
|
67 | 67 | $this->errors[] = "{$var['name']}: expected '{$expected}' but got '{$got}'"; |
68 | 68 | } |
69 | 69 | } |