@@ -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 | |
@@ -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 | ); |