@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace PragmaRX\Health\Checkers; |
| 4 | 4 | |
| 5 | -use Illuminate\Queue\Worker; |
|
| 6 | 5 | use Illuminate\Queue\WorkerOptions; |
| 7 | 6 | use PragmaRX\Health\Support\Result; |
| 8 | 7 | |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | protected function bootRouter() |
| 16 | 16 | { |
| 17 | - $this->target->routes->each(function ($route, $name) { |
|
| 17 | + $this->target->routes->each(function($route, $name) { |
|
| 18 | 18 | $this->registerRoute($route, $name); |
| 19 | 19 | }); |
| 20 | 20 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | $this->bootRouter(); |
| 32 | 32 | |
| 33 | - $isHealthy = ! $this->pingTimedout(); |
|
| 33 | + $isHealthy = !$this->pingTimedout(); |
|
| 34 | 34 | |
| 35 | 35 | $this->createPing(); |
| 36 | 36 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function pong($secret) |
| 97 | 97 | { |
| 98 | - $this->database = $this->database->map(function ($item) use ($secret) { |
|
| 98 | + $this->database = $this->database->map(function($item) use ($secret) { |
|
| 99 | 99 | if ($item['secret'] == $secret) { |
| 100 | 100 | $item['ponged_at'] = Carbon::now(); |
| 101 | 101 | } |
@@ -115,10 +115,10 @@ discard block |
||
| 115 | 115 | { |
| 116 | 116 | $timedout = false; |
| 117 | 117 | |
| 118 | - $this->database = $this->database->filter(function ($item) use ( |
|
| 118 | + $this->database = $this->database->filter(function($item) use ( |
|
| 119 | 119 | &$timedout |
| 120 | 120 | ) { |
| 121 | - if (! $item['ponged_at']) { |
|
| 121 | + if (!$item['ponged_at']) { |
|
| 122 | 122 | if ( |
| 123 | 123 | Carbon::now()->diffInSeconds( |
| 124 | 124 | $this->parseDate($item['pinged_at']) |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | 'middleware' => isset($route['middleware']) ? $route['middleware'] : [], |
| 15 | 15 | ]; |
| 16 | 16 | |
| 17 | - $this->getRouter()->group($attributes, function () use ($route, $name) { |
|
| 17 | + $this->getRouter()->group($attributes, function() use ($route, $name) { |
|
| 18 | 18 | $action = isset($route['controller']) |
| 19 | 19 | ? "{$route['controller']}@{$route['action']}" |
| 20 | 20 | : $route['action']; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * Resource factory. |
| 88 | 88 | * |
| 89 | 89 | * @param Collection $data |
| 90 | - * @return resource |
|
| 90 | + * @return Resource |
|
| 91 | 91 | * @throws \Exception |
| 92 | 92 | */ |
| 93 | 93 | public static function factory(Collection $data) |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * Check all targets for a resource. |
| 177 | 177 | * |
| 178 | 178 | * @param string $action |
| 179 | - * @return resource |
|
| 179 | + * @return Resource |
|
| 180 | 180 | */ |
| 181 | 181 | public function check($action = 'resource') |
| 182 | 182 | { |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | * Check global resources. |
| 196 | 196 | * |
| 197 | 197 | * @param $resources |
| 198 | - * @return resource |
|
| 198 | + * @return Resource |
|
| 199 | 199 | */ |
| 200 | 200 | public function checkGlobal($resources) |
| 201 | 201 | { |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | * Set current action. |
| 280 | 280 | * |
| 281 | 281 | * @param string $currentAction |
| 282 | - * @return resource |
|
| 282 | + * @return Resource |
|
| 283 | 283 | */ |
| 284 | 284 | public function setCurrentAction(string $currentAction) |
| 285 | 285 | { |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | * Resources setter. |
| 293 | 293 | * |
| 294 | 294 | * @param $resources |
| 295 | - * @return resource |
|
| 295 | + * @return Resource |
|
| 296 | 296 | */ |
| 297 | 297 | protected function setResources($resources) |
| 298 | 298 | { |
@@ -146,12 +146,12 @@ discard block |
||
| 146 | 146 | $current = collect(); |
| 147 | 147 | |
| 148 | 148 | $targets = $targets |
| 149 | - ->map(function (Collection $targetList) { |
|
| 150 | - return $targetList->map(function ($target, $name) { |
|
| 149 | + ->map(function(Collection $targetList) { |
|
| 150 | + return $targetList->map(function($target, $name) { |
|
| 151 | 151 | return Target::factory($this, $target, $name); |
| 152 | 152 | }); |
| 153 | 153 | }) |
| 154 | - ->reduce(function ($current, $targetList) { |
|
| 154 | + ->reduce(function($current, $targetList) { |
|
| 155 | 155 | foreach ($targetList as $target) { |
| 156 | 156 | $current[] = $target; |
| 157 | 157 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | public function check($action = 'resource') |
| 183 | 183 | { |
| 184 | - $this->setCurrentAction($action)->targets->each(function ( |
|
| 184 | + $this->setCurrentAction($action)->targets->each(function( |
|
| 185 | 185 | Target $target |
| 186 | 186 | ) { |
| 187 | 187 | $target->check($target); |
@@ -210,14 +210,14 @@ discard block |
||
| 210 | 210 | */ |
| 211 | 211 | public function isHealthy() |
| 212 | 212 | { |
| 213 | - return $this->targets->reduce(function ($carry, $target) { |
|
| 213 | + return $this->targets->reduce(function($carry, $target) { |
|
| 214 | 214 | return $carry && $target->result->healthy; |
| 215 | 215 | }, true); |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | protected function keysToCamel($array) |
| 219 | 219 | { |
| 220 | - return collect($array)->mapWithKeys(function ($item, $key) { |
|
| 220 | + return collect($array)->mapWithKeys(function($item, $key) { |
|
| 221 | 221 | return [Str::camel($key) => $item]; |
| 222 | 222 | }); |
| 223 | 223 | } |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | */ |
| 240 | 240 | protected function sendNotifications() |
| 241 | 241 | { |
| 242 | - return collect(config('health.notifications.channels'))->each(function ( |
|
| 242 | + return collect(config('health.notifications.channels'))->each(function( |
|
| 243 | 243 | $channel |
| 244 | 244 | ) { |
| 245 | 245 | try { |
@@ -258,9 +258,9 @@ discard block |
||
| 258 | 258 | protected function canNotify() |
| 259 | 259 | { |
| 260 | 260 | return |
| 261 | - ! $this->notified && |
|
| 261 | + !$this->notified && |
|
| 262 | 262 | $this->notificationsAreEnabled() && |
| 263 | - ! $this->isHealthy(); |
|
| 263 | + !$this->isHealthy(); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | /** |
@@ -13,10 +13,10 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function importProperties($data) |
| 15 | 15 | { |
| 16 | - $data->each(function ($value, $key) { |
|
| 16 | + $data->each(function($value, $key) { |
|
| 17 | 17 | $key = Str::camel($key); |
| 18 | 18 | |
| 19 | - if (! property_exists($this, $key)) { |
|
| 19 | + if (!property_exists($this, $key)) { |
|
| 20 | 20 | $this->$key = $value; |
| 21 | 21 | } |
| 22 | 22 | }); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | private function getNotifiableUsers() |
| 17 | 17 | { |
| 18 | 18 | return collect(config('health.notifications.users.emails'))->map( |
| 19 | - function ($item) { |
|
| 19 | + function($item) { |
|
| 20 | 20 | $model = instantiate( |
| 21 | 21 | config('health.notifications.users.model') |
| 22 | 22 | ); |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | $notifierClass = HealthStatus::class; |
| 45 | 45 | } |
| 46 | 46 | try { |
| 47 | - $event->failure->targets->each(function ($target) use ($event, $notifierClass) { |
|
| 48 | - if (! $target->result->healthy) { |
|
| 47 | + $event->failure->targets->each(function($target) use ($event, $notifierClass) { |
|
| 48 | + if (!$target->result->healthy) { |
|
| 49 | 49 | Notification::send( |
| 50 | 50 | $this->getNotifiableUsers(), |
| 51 | 51 | $notifierClass->newInstance($target, $event->channel) |
@@ -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 | ); |
@@ -15,6 +15,9 @@ |
||
| 15 | 15 | : \PHP_Timer::start(); |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | + /** |
|
| 19 | + * @return double |
|
| 20 | + */ |
|
| 18 | 21 | public static function stop() |
| 19 | 22 | { |
| 20 | 23 | return class_exists('SebastianBergmann\Timer\Timer') |
@@ -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 | } |