@@ -70,7 +70,7 @@ |
||
70 | 70 | */ |
71 | 71 | private function sendMail() |
72 | 72 | { |
73 | - IlluminateMail::send($this->target->view, [], function ($message) { |
|
73 | + IlluminateMail::send($this->target->view, [], function($message) { |
|
74 | 74 | $fromAddress = Arr::get($this->target->config, 'from.address'); |
75 | 75 | |
76 | 76 | $message->returnPath($fromAddress); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | $cache = call_user_func($this->cacheClosure); |
132 | 132 | |
133 | - $this->healthServiceClosure = function () use ( |
|
133 | + $this->healthServiceClosure = function() use ( |
|
134 | 134 | $resourceChecker, |
135 | 135 | $cache |
136 | 136 | ) { |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | */ |
163 | 163 | private function getCacheClosure() |
164 | 164 | { |
165 | - $cacheClosure = function () { |
|
165 | + $cacheClosure = function() { |
|
166 | 166 | return new Cache(); |
167 | 167 | }; |
168 | 168 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | private function getResourceCheckerClosure($resourceLoader, $cache) |
180 | 180 | { |
181 | - $resourceCheckerInstance = function () use ($resourceLoader, $cache) { |
|
181 | + $resourceCheckerInstance = function() use ($resourceLoader, $cache) { |
|
182 | 182 | return new ResourceChecker($resourceLoader, $cache); |
183 | 183 | }; |
184 | 184 | |
@@ -259,9 +259,9 @@ discard block |
||
259 | 259 | |
260 | 260 | private function registerResourcesRoutes() |
261 | 261 | { |
262 | - collect($this->resourceLoader->getResources())->each(function ($item) { |
|
262 | + collect($this->resourceLoader->getResources())->each(function($item) { |
|
263 | 263 | if (isset($item['routes'])) { |
264 | - collect($item['routes'])->each(function ($route, $key) { |
|
264 | + collect($item['routes'])->each(function($route, $key) { |
|
265 | 265 | $this->registerRoute($route, $key); |
266 | 266 | }); |
267 | 267 | } |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | */ |
293 | 293 | private function registerRoutes() |
294 | 294 | { |
295 | - collect(($routes = $this->getRoutes()))->each(function ($route) { |
|
295 | + collect(($routes = $this->getRoutes()))->each(function($route) { |
|
296 | 296 | $this->registerRoute($route); |
297 | 297 | }); |
298 | 298 | |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | |
318 | 318 | $this->app->singleton( |
319 | 319 | 'pragmarx.health.commands', |
320 | - function () { |
|
320 | + function() { |
|
321 | 321 | return $this->instantiateCommands(); |
322 | 322 | } |
323 | 323 | ); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | public static function getSBInstance() |
45 | 45 | { |
46 | - if (! empty(static::$sbTimer)) { |
|
46 | + if (!empty(static::$sbTimer)) { |
|
47 | 47 | return static::$sbTimer; |
48 | 48 | } |
49 | 49 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | public static function getStaticMethodNames() |
54 | 54 | { |
55 | - return collect((new \ReflectionClass(SBTimer::class))->getMethods(\ReflectionMethod::IS_STATIC))->map(function ($method) { |
|
55 | + return collect((new \ReflectionClass(SBTimer::class))->getMethods(\ReflectionMethod::IS_STATIC))->map(function($method) { |
|
56 | 56 | return $method->name; |
57 | 57 | }); |
58 | 58 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $parameters |
49 | 49 | ); |
50 | 50 | |
51 | - if (! $healthy) { |
|
51 | + if (!$healthy) { |
|
52 | 52 | return $this->makeResult($healthy, $message); |
53 | 53 | } |
54 | 54 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | */ |
198 | 198 | private function onStatsCallback() |
199 | 199 | { |
200 | - return function (TransferStats $stats) { |
|
200 | + return function(TransferStats $stats) { |
|
201 | 201 | $this->totalTime = $stats->getTransferTime(); |
202 | 202 | }; |
203 | 203 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | throw new \Exception((string) $response->getBody()); |
219 | 219 | } |
220 | 220 | |
221 | - return ! $this->requestTimeout(); |
|
221 | + return !$this->requestTimeout(); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | /** |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | */ |
257 | 257 | protected function getMethod($parameters) |
258 | 258 | { |
259 | - if (! isset($parameters['method'])) { |
|
259 | + if (!isset($parameters['method'])) { |
|
260 | 260 | return 'GET'; |
261 | 261 | } |
262 | 262 |
@@ -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 |
@@ -148,12 +148,12 @@ discard block |
||
148 | 148 | $current = collect(); |
149 | 149 | |
150 | 150 | $targets = $targets |
151 | - ->map(function (Collection $targetList) { |
|
152 | - return $targetList->map(function ($target, $name) { |
|
151 | + ->map(function(Collection $targetList) { |
|
152 | + return $targetList->map(function($target, $name) { |
|
153 | 153 | return Target::factory($this, $target, $name); |
154 | 154 | }); |
155 | 155 | }) |
156 | - ->reduce(function ($current, $targetList) { |
|
156 | + ->reduce(function($current, $targetList) { |
|
157 | 157 | foreach ($targetList as $target) { |
158 | 158 | $current[] = $target; |
159 | 159 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public function check($action = 'resource') |
185 | 185 | { |
186 | - $this->setCurrentAction($action)->targets->each(function ( |
|
186 | + $this->setCurrentAction($action)->targets->each(function( |
|
187 | 187 | Target $target |
188 | 188 | ) { |
189 | 189 | $target->check($target); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | */ |
213 | 213 | public function isHealthy() |
214 | 214 | { |
215 | - return $this->targets->reduce(function ($carry, $target) { |
|
215 | + return $this->targets->reduce(function($carry, $target) { |
|
216 | 216 | return $carry && $target->result->healthy; |
217 | 217 | }, true); |
218 | 218 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | public function getStatus() |
226 | 226 | { |
227 | 227 | $exitCode = Commands::EXIT_CODES[result::OK]; |
228 | - $this->targets->each(function ($target) use (&$exitCode) { |
|
228 | + $this->targets->each(function($target) use (&$exitCode) { |
|
229 | 229 | // Handles exit codes based on the result's status. |
230 | 230 | $thisStatus = $target->result->getStatus(); |
231 | 231 | $thisExitCode = Commands::EXIT_CODES[$thisStatus]; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | protected function keysToCamel($array) |
242 | 242 | { |
243 | - return collect($array)->mapWithKeys(function ($item, $key) { |
|
243 | + return collect($array)->mapWithKeys(function($item, $key) { |
|
244 | 244 | return [Str::camel($key) => $item]; |
245 | 245 | }); |
246 | 246 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | */ |
263 | 263 | protected function sendNotifications() |
264 | 264 | { |
265 | - return collect(config('health.notifications.channels'))->each(function ( |
|
265 | + return collect(config('health.notifications.channels'))->each(function( |
|
266 | 266 | $channel |
267 | 267 | ) { |
268 | 268 | try { |
@@ -281,9 +281,9 @@ discard block |
||
281 | 281 | protected function canNotify() |
282 | 282 | { |
283 | 283 | return |
284 | - ! $this->notified && |
|
284 | + !$this->notified && |
|
285 | 285 | $this->notificationsAreEnabled() && |
286 | - ! $this->isHealthy(); |
|
286 | + !$this->isHealthy(); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | /** |
@@ -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 |