@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | /** |
| 50 | 50 | * Create base directory for files. |
| 51 | 51 | * |
| 52 | - * @param $fileName |
|
| 52 | + * @param null|string $fileName |
|
| 53 | 53 | */ |
| 54 | 54 | private function makeDir($fileName) |
| 55 | 55 | { |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
| 84 | - * @param $exception |
|
| 84 | + * @param \Exception $exception |
|
| 85 | 85 | * @return array |
| 86 | 86 | */ |
| 87 | 87 | protected function makeResultFromException($exception) |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | - * @param $healthy |
|
| 111 | + * @param boolean $healthy |
|
| 112 | 112 | */ |
| 113 | 113 | public function setHealthy($healthy) |
| 114 | 114 | { |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | { |
| 56 | 56 | $dir = dirname($fileName); |
| 57 | 57 | |
| 58 | - if (! file_exists($dir)) { |
|
| 58 | + if (!file_exists($dir)) { |
|
| 59 | 59 | mkdir($dir, 0775, true); |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public function load() |
| 144 | 144 | { |
| 145 | - if (! file_exists($file = $this->getFileName())) { |
|
| 145 | + if (!file_exists($file = $this->getFileName())) { |
|
| 146 | 146 | return collect(); |
| 147 | 147 | } |
| 148 | 148 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $data = $this->database->toArray(); |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - if (! is_array($data)) { |
|
| 163 | + if (!is_array($data)) { |
|
| 164 | 164 | $data = $data->toArray(); |
| 165 | 165 | } |
| 166 | 166 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | protected function getFileName() |
| 178 | 178 | { |
| 179 | - if (! isset($this->resource['save_to'])) { |
|
| 179 | + if (!isset($this->resource['save_to'])) { |
|
| 180 | 180 | return; |
| 181 | 181 | } |
| 182 | 182 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | $resourceChecker = $this->makeResourceChecker(); |
| 83 | 83 | |
| 84 | - $checker = function () use ($resourceChecker) { |
|
| 84 | + $checker = function() use ($resourceChecker) { |
|
| 85 | 85 | $resourceChecker(false); |
| 86 | 86 | |
| 87 | 87 | $resourceChecker(true); |
@@ -150,8 +150,8 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | private function makeResourceChecker() |
| 152 | 152 | { |
| 153 | - $resourceChecker = function ($allowGlobal) { |
|
| 154 | - $this->resources = $this->getResources()->map(function ($item, $key) use ($allowGlobal) { |
|
| 153 | + $resourceChecker = function($allowGlobal) { |
|
| 154 | + $this->resources = $this->getResources()->map(function($item, $key) use ($allowGlobal) { |
|
| 155 | 155 | if ($item['is_global'] == $allowGlobal) { |
| 156 | 156 | $item['health'] = $this->checkResource($key); |
| 157 | 157 | } |
@@ -173,9 +173,9 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | private function canNotify($name, $health, $resource) |
| 175 | 175 | { |
| 176 | - return (! $health['healthy']) |
|
| 176 | + return (!$health['healthy']) |
|
| 177 | 177 | && $this->notificationIsEnabled($resource) |
| 178 | - && ! isset($this->notified[$name]); |
|
| 178 | + && !isset($this->notified[$name]); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | /** |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | ? $exception->getMessage() |
| 192 | 192 | : static::UNKNOWN_ERROR; |
| 193 | 193 | |
| 194 | - if (! isset($resourceChecker)) { |
|
| 194 | + if (!isset($resourceChecker)) { |
|
| 195 | 195 | return [ |
| 196 | 196 | null, |
| 197 | 197 | [ |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | */ |
| 228 | 228 | private function notify($resource) |
| 229 | 229 | { |
| 230 | - return collect(config('health.notifications.channels'))->filter(function ($value, $channel) use ($resource) { |
|
| 230 | + return collect(config('health.notifications.channels'))->filter(function($value, $channel) use ($resource) { |
|
| 231 | 231 | try { |
| 232 | 232 | event(new RaiseHealthIssue($resource, $channel)); |
| 233 | 233 | } catch (\Exception $exception) { |
@@ -110,8 +110,7 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | private function getErrorMessage() |
| 112 | 112 | { |
| 113 | - $message = array_get($this->resource, 'timeout_message') ?: |
|
| 114 | - '[TIMEOUT] A request to %s took %s seconds. Timeout is set to %s seconds.'; |
|
| 113 | + $message = array_get($this->resource, 'timeout_message') ?: '[TIMEOUT] A request to %s took %s seconds. Timeout is set to %s seconds.'; |
|
| 115 | 114 | |
| 116 | 115 | return sprintf( |
| 117 | 116 | $message, |
@@ -160,7 +159,7 @@ discard block |
||
| 160 | 159 | */ |
| 161 | 160 | private function onStatsCallback() |
| 162 | 161 | { |
| 163 | - return function (TransferStats $stats) { |
|
| 162 | + return function(TransferStats $stats) { |
|
| 164 | 163 | $this->totalTime = $stats->getTransferTime(); |
| 165 | 164 | }; |
| 166 | 165 | } |
@@ -176,7 +175,7 @@ discard block |
||
| 176 | 175 | private function requestSuccessful($url, $ssl) |
| 177 | 176 | { |
| 178 | 177 | return $this->fetchResponse($url, $ssl)->getStatusCode() == 200 && |
| 179 | - ! $this->requestTimedout(); |
|
| 178 | + !$this->requestTimedout(); |
|
| 180 | 179 | } |
| 181 | 180 | |
| 182 | 181 | /** |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * |
| 75 | 75 | * @param $url |
| 76 | 76 | * @param $ssl |
| 77 | - * @return mixed|\Psr\Http\Message\ResponseInterface |
|
| 77 | + * @return \Psr\Http\Message\ResponseInterface |
|
| 78 | 78 | */ |
| 79 | 79 | private function fetchResponse($url, $ssl) |
| 80 | 80 | { |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | * Make a url with a proper scheme. |
| 146 | 146 | * |
| 147 | 147 | * @param $url |
| 148 | - * @param $secure |
|
| 148 | + * @param boolean $secure |
|
| 149 | 149 | * @return mixed |
| 150 | 150 | */ |
| 151 | 151 | private function makeUrlWithScheme($url, $secure) |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | * Send a request and get the result. |
| 170 | 170 | * |
| 171 | 171 | * @param $url |
| 172 | - * @param $ssl |
|
| 172 | + * @param boolean $ssl |
|
| 173 | 173 | * @return bool |
| 174 | 174 | * @internal param $response |
| 175 | 175 | */ |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | public function check() |
| 11 | 11 | { |
| 12 | 12 | try { |
| 13 | - collect($this->resource['models'])->each(function ($model) { |
|
| 13 | + collect($this->resource['models'])->each(function($model) { |
|
| 14 | 14 | instantiate($model)->first(); |
| 15 | 15 | }); |
| 16 | 16 | |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | */ |
| 41 | 41 | protected function isHealthy() |
| 42 | 42 | { |
| 43 | - $healthy = $this->resources->reduce(function ($carry, $item) { |
|
| 43 | + $healthy = $this->resources->reduce(function($carry, $item) { |
|
| 44 | 44 | return $this->computeHealth($carry, $item); |
| 45 | 45 | }, true); |
| 46 | 46 | |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace |
| 4 | 4 | { |
| 5 | - if (! interface_exists('Throwable')) { |
|
| 5 | + if (!interface_exists('Throwable')) { |
|
| 6 | 6 | interface Throwable |
| 7 | 7 | { |
| 8 | 8 | public function getMessage(); |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | private function getNotifiableUsers() |
| 15 | 15 | { |
| 16 | - return collect(config('health.notifications.users.emails'))->map(function ($item) { |
|
| 16 | + return collect(config('health.notifications.users.emails'))->map(function($item) { |
|
| 17 | 17 | $model = instantiate(config('health.notifications.users.model')); |
| 18 | 18 | |
| 19 | 19 | $model->email = $item; |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | */ |
| 85 | 85 | protected function needsToFlush() |
| 86 | 86 | { |
| 87 | - return ! $this->cacheFlushed && |
|
| 87 | + return !$this->cacheFlushed && |
|
| 88 | 88 | $this->getMinutes() !== false && |
| 89 | 89 | $this->getCurrentRequest()->get('flush'); |
| 90 | 90 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | { |
| 50 | 50 | $messages = []; |
| 51 | 51 | |
| 52 | - $result = collect($this->resource['files'])->map(function ($checkType, $file) use (&$messages) { |
|
| 52 | + $result = collect($this->resource['files'])->map(function($checkType, $file) use (&$messages) { |
|
| 53 | 53 | $isGood = true; |
| 54 | 54 | |
| 55 | 55 | foreach ($this->getCheckers()[$checkType] as $checker) { |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | return $isGood; |
| 63 | - })->filter(function ($value) { |
|
| 63 | + })->filter(function($value) { |
|
| 64 | 64 | return $value === false; |
| 65 | 65 | }); |
| 66 | 66 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function buildFileExistsChecker() |
| 76 | 76 | { |
| 77 | - return function ($file) { |
|
| 77 | + return function($file) { |
|
| 78 | 78 | return $this->fileExists($file); |
| 79 | 79 | }; |
| 80 | 80 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function buildFileDoesNotExistsChecker() |
| 88 | 88 | { |
| 89 | - return function ($file) { |
|
| 89 | + return function($file) { |
|
| 90 | 90 | return $this->fileDoesNotExists($file); |
| 91 | 91 | }; |
| 92 | 92 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | public function buildIsDirectoryChecker() |
| 100 | 100 | { |
| 101 | - return function ($file) { |
|
| 101 | + return function($file) { |
|
| 102 | 102 | return $this->isDirectory($file); |
| 103 | 103 | }; |
| 104 | 104 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | public function fileDoesNotExists($file) |
| 152 | 152 | { |
| 153 | - if (! file_exists($file)) { |
|
| 153 | + if (!file_exists($file)) { |
|
| 154 | 154 | return true; |
| 155 | 155 | } |
| 156 | 156 | |