@@ -9,7 +9,7 @@ |
||
9 | 9 | class NotifyHealthIssue |
10 | 10 | { |
11 | 11 | /** |
12 | - * @return static |
|
12 | + * @return \Illuminate\Support\Collection |
|
13 | 13 | */ |
14 | 14 | private function getNotifiableUsers() |
15 | 15 | { |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | private function getNotifiableUsers() |
15 | 15 | { |
16 | 16 | return collect(config('health.notifications.users.emails'))->map( |
17 | - function ($item) { |
|
17 | + function($item) { |
|
18 | 18 | $model = instantiate( |
19 | 19 | config('health.notifications.users.model') |
20 | 20 | ); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | public function handle(RaiseHealthIssue $event) |
36 | 36 | { |
37 | 37 | try { |
38 | - $event->failure->targets->each(function ($target) use ($event) { |
|
38 | + $event->failure->targets->each(function($target) use ($event) { |
|
39 | 39 | if (!$target->result->healthy) { |
40 | 40 | Notification::send( |
41 | 41 | $this->getNotifiableUsers(), |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | /** |
143 | 143 | * Get the resource checker closure for instantiation. |
144 | 144 | * |
145 | - * @param $resourceLoader |
|
145 | + * @param ResourceLoader $resourceLoader |
|
146 | 146 | * @param $cache |
147 | 147 | * @return \Closure |
148 | 148 | */ |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | /** |
355 | 355 | * Get the services provided by the provider. |
356 | 356 | * |
357 | - * @return array |
|
357 | + * @return string[] |
|
358 | 358 | */ |
359 | 359 | public function provides() |
360 | 360 | { |
@@ -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 | |
@@ -257,9 +257,9 @@ discard block |
||
257 | 257 | |
258 | 258 | private function registerResourcesRoutes() |
259 | 259 | { |
260 | - collect($this->resourceLoader->getResources())->each(function ($item) { |
|
260 | + collect($this->resourceLoader->getResources())->each(function($item) { |
|
261 | 261 | if (isset($item['routes'])) { |
262 | - collect($item['routes'])->each(function ($route, $key) { |
|
262 | + collect($item['routes'])->each(function($route, $key) { |
|
263 | 263 | $this->registerRoute($route, $key); |
264 | 264 | }); |
265 | 265 | } |
@@ -273,11 +273,11 @@ discard block |
||
273 | 273 | { |
274 | 274 | $commands = $this->commands; |
275 | 275 | |
276 | - Artisan::command('health:panel', function () use ($commands) { |
|
276 | + Artisan::command('health:panel', function() use ($commands) { |
|
277 | 277 | $commands->panel($this); |
278 | 278 | })->describe('Show all resources and their current health states.'); |
279 | 279 | |
280 | - Artisan::command('health:check', function () use ($commands) { |
|
280 | + Artisan::command('health:check', function() use ($commands) { |
|
281 | 281 | $commands->check($this); |
282 | 282 | })->describe('Check resources health and send error notifications.'); |
283 | 283 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | */ |
296 | 296 | private function registerRoutes() |
297 | 297 | { |
298 | - collect($routes = $this->getRoutes())->each(function ($route) { |
|
298 | + collect($routes = $this->getRoutes())->each(function($route) { |
|
299 | 299 | $this->registerRoute($route); |
300 | 300 | }); |
301 | 301 |
@@ -25,9 +25,9 @@ |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
28 | - * @param $name |
|
29 | - * @param $content |
|
30 | - * @param null $folder |
|
28 | + * @param string $name |
|
29 | + * @param string $content |
|
30 | + * @param string $folder |
|
31 | 31 | * @return string |
32 | 32 | */ |
33 | 33 | private function temporaryFile($name, $content, $folder = null) |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | storage_path() |
19 | 19 | ); |
20 | 20 | |
21 | - if (! file_exists($file)) { |
|
21 | + if (!file_exists($file)) { |
|
22 | 22 | return $this->makeResult( |
23 | 23 | false, |
24 | 24 | sprintf($this->target->getErrorMessage(), $file) |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | file_put_contents($file, $content); |
49 | 49 | |
50 | - register_shutdown_function(function () use ($file) { |
|
50 | + register_shutdown_function(function() use ($file) { |
|
51 | 51 | if (file_exists($file)) { |
52 | 52 | unlink($file); |
53 | 53 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * Convert uptime to seconds. |
140 | 140 | * |
141 | 141 | * @param $date |
142 | - * @return int |
|
142 | + * @return double |
|
143 | 143 | */ |
144 | 144 | protected function uptimeInSeconds($date) |
145 | 145 | { |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * Make uptime message. |
153 | 153 | * |
154 | 154 | * @param $current |
155 | - * @param $saved |
|
155 | + * @param \Illuminate\Support\Collection $saved |
|
156 | 156 | * @return string |
157 | 157 | */ |
158 | 158 | protected function makeMessage($current, $saved = null) |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | ($ss = $this->uptimeInSeconds($this->database)); |
25 | 25 | |
26 | 26 | return $this->makeResult( |
27 | - ! $rebooted, |
|
27 | + !$rebooted, |
|
28 | 28 | $this->makeMessage($current, $this->database) |
29 | 29 | ); |
30 | 30 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | throw new DomainException((string) $error); |
44 | 44 | } |
45 | 45 | |
46 | - return (! is_array($system_string) || empty($system_string)) |
|
46 | + return (!is_array($system_string) || empty($system_string)) |
|
47 | 47 | ? '' |
48 | 48 | : $system_string[0]; |
49 | 49 | } |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | protected function normalizeMatches($matches) |
69 | 69 | { |
70 | 70 | return collect($matches) |
71 | - ->filter(function ($item, $key) { |
|
72 | - return ! is_numeric($key); |
|
71 | + ->filter(function($item, $key) { |
|
72 | + return !is_numeric($key); |
|
73 | 73 | }) |
74 | - ->map(function ($item, $key) { |
|
74 | + ->map(function($item, $key) { |
|
75 | 75 | $return = $item[0]; |
76 | 76 | |
77 | 77 | if (starts_with($key, 'load')) { |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * Convert uptime to seconds. |
140 | 140 | * |
141 | 141 | * @param $date |
142 | - * @return int |
|
142 | + * @return double |
|
143 | 143 | */ |
144 | 144 | protected function uptimeInSeconds($date) |
145 | 145 | { |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * Make uptime message. |
153 | 153 | * |
154 | 154 | * @param $current |
155 | - * @param $saved |
|
155 | + * @param \Illuminate\Support\Collection $saved |
|
156 | 156 | * @return string |
157 | 157 | */ |
158 | 158 | protected function makeMessage($current, $saved = null) |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | ($ss = $this->uptimeInSeconds($this->database)); |
25 | 25 | |
26 | 26 | return $this->makeResult( |
27 | - ! $rebooted, |
|
27 | + !$rebooted, |
|
28 | 28 | $this->makeMessage($current, $this->database) |
29 | 29 | ); |
30 | 30 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | throw new DomainException((string) $error); |
44 | 44 | } |
45 | 45 | |
46 | - return (! is_array($system_string) || empty($system_string)) |
|
46 | + return (!is_array($system_string) || empty($system_string)) |
|
47 | 47 | ? '' |
48 | 48 | : $system_string[0]; |
49 | 49 | } |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | protected function normalizeMatches($matches) |
69 | 69 | { |
70 | 70 | return collect($matches) |
71 | - ->filter(function ($item, $key) { |
|
72 | - return ! is_numeric($key); |
|
71 | + ->filter(function($item, $key) { |
|
72 | + return !is_numeric($key); |
|
73 | 73 | }) |
74 | - ->map(function ($item, $key) { |
|
74 | + ->map(function($item, $key) { |
|
75 | 75 | $return = $item[0]; |
76 | 76 | |
77 | 77 | if (starts_with($key, 'load')) { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * Check if string is absolute path. |
58 | 58 | * |
59 | 59 | * @param $path |
60 | - * @return string |
|
60 | + * @return boolean |
|
61 | 61 | */ |
62 | 62 | function is_absolute_path($path) |
63 | 63 | { |
@@ -84,6 +84,7 @@ discard block |
||
84 | 84 | /** |
85 | 85 | * Convert bytes to human readable. |
86 | 86 | * |
87 | + * @param double $bytes |
|
87 | 88 | * @return string |
88 | 89 | */ |
89 | 90 | function bytes_to_human($bytes) |
@@ -102,7 +103,7 @@ discard block |
||
102 | 103 | /** |
103 | 104 | * Convert bytes to human readable. |
104 | 105 | * |
105 | - * @return string |
|
106 | + * @return double |
|
106 | 107 | */ |
107 | 108 | function human_to_bytes($str) |
108 | 109 | { |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | use PragmaRX\Health\Service; |
4 | 4 | |
5 | -if (! function_exists('instantiate')) { |
|
5 | +if (!function_exists('instantiate')) { |
|
6 | 6 | /** |
7 | 7 | * Instantiate a class. |
8 | 8 | * |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | } |
23 | 23 | } |
24 | 24 | |
25 | -if (! function_exists('package_dir')) { |
|
25 | +if (!function_exists('package_dir')) { |
|
26 | 26 | /** |
27 | 27 | * Get the package root directory. |
28 | 28 | * |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | -if (! function_exists('package_resources_dir')) { |
|
39 | +if (!function_exists('package_resources_dir')) { |
|
40 | 40 | /** |
41 | 41 | * Get package resources directory. |
42 | 42 | * |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | -if (! function_exists('is_absolute_path')) { |
|
55 | +if (!function_exists('is_absolute_path')) { |
|
56 | 56 | /** |
57 | 57 | * Check if string is absolute path. |
58 | 58 | * |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | -if (! function_exists('bytes_to_human')) { |
|
83 | +if (!function_exists('bytes_to_human')) { |
|
84 | 84 | /** |
85 | 85 | * Convert bytes to human readable. |
86 | 86 | * |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
101 | -if (! function_exists('human_to_bytes')) { |
|
101 | +if (!function_exists('human_to_bytes')) { |
|
102 | 102 | /** |
103 | 103 | * Convert bytes to human readable. |
104 | 104 | * |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
129 | -if (! function_exists('ip_address_from_hostname')) { |
|
129 | +if (!function_exists('ip_address_from_hostname')) { |
|
130 | 130 | function ip_address_from_hostname($host) |
131 | 131 | { |
132 | 132 | if ( |
@@ -41,7 +41,7 @@ |
||
41 | 41 | |
42 | 42 | private function getChecker() |
43 | 43 | { |
44 | - return function () { |
|
44 | + return function() { |
|
45 | 45 | return 'DUMMY DATA'; |
46 | 46 | }; |
47 | 47 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | |
27 | 27 | /** |
28 | 28 | * @param $hostname |
29 | - * @return mixed |
|
29 | + * @return string |
|
30 | 30 | */ |
31 | 31 | protected function hosnameAndIp($hostname, $ipAdress) |
32 | 32 | { |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | protected function hosnameAndIp($hostname, $ipAdress) |
61 | 61 | { |
62 | - return $hostname . ($hostname != $ipAdress ? " ({$ipAdress})" : ''); |
|
62 | + return $hostname.($hostname != $ipAdress ? " ({$ipAdress})" : ''); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -82,35 +82,35 @@ discard block |
||
82 | 82 | if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { |
83 | 83 | // -n = number of pings; -i = ttl; -w = timeout (in milliseconds). |
84 | 84 | $exec_string = |
85 | - $this->pingBin . |
|
86 | - ' -n 1 -i ' . |
|
87 | - $ttl . |
|
88 | - ' -w ' . |
|
89 | - ($timeout * 1000) . |
|
90 | - ' ' . |
|
85 | + $this->pingBin. |
|
86 | + ' -n 1 -i '. |
|
87 | + $ttl. |
|
88 | + ' -w '. |
|
89 | + ($timeout * 1000). |
|
90 | + ' '. |
|
91 | 91 | $host; |
92 | 92 | } elseif (strtoupper(PHP_OS) === 'DARWIN') { |
93 | 93 | // Exec string for Darwin based systems (OS X). |
94 | 94 | // -n = numeric output; -c = number of pings; -m = ttl; -t = timeout. |
95 | 95 | $exec_string = |
96 | - $this->pingBin . |
|
97 | - ' -n -c 1 -m ' . |
|
98 | - $ttl . |
|
99 | - ' -t ' . |
|
100 | - $timeout . |
|
101 | - ' ' . |
|
96 | + $this->pingBin. |
|
97 | + ' -n -c 1 -m '. |
|
98 | + $ttl. |
|
99 | + ' -t '. |
|
100 | + $timeout. |
|
101 | + ' '. |
|
102 | 102 | $host; |
103 | 103 | } else { |
104 | 104 | // Exec string for other UNIX-based systems (Linux). |
105 | 105 | // -n = numeric output; -c = number of pings; -t = ttl; -W = timeout |
106 | 106 | $exec_string = |
107 | - $this->pingBin . |
|
108 | - ' -n -c 1 -t ' . |
|
109 | - $ttl . |
|
110 | - ' -W ' . |
|
111 | - $timeout . |
|
112 | - ' ' . |
|
113 | - $host . |
|
107 | + $this->pingBin. |
|
108 | + ' -n -c 1 -t '. |
|
109 | + $ttl. |
|
110 | + ' -W '. |
|
111 | + $timeout. |
|
112 | + ' '. |
|
113 | + $host. |
|
114 | 114 | ' 2>&1'; |
115 | 115 | } |
116 | 116 |
@@ -9,7 +9,7 @@ |
||
9 | 9 | /** |
10 | 10 | * Check resource. |
11 | 11 | * |
12 | - * @return bool |
|
12 | + * @return \PragmaRX\Health\Support\Result |
|
13 | 13 | */ |
14 | 14 | public function check() |
15 | 15 | { |