@@ -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,8 +35,8 @@ discard block |
||
35 | 35 | public function handle(RaiseHealthIssue $event) |
36 | 36 | { |
37 | 37 | try { |
38 | - $event->failure->targets->each(function ($target) use ($event) { |
|
39 | - if (! $target->result->healthy) { |
|
38 | + $event->failure->targets->each(function($target) use ($event) { |
|
39 | + if (!$target->result->healthy) { |
|
40 | 40 | Notification::send( |
41 | 41 | $this->getNotifiableUsers(), |
42 | 42 | new HealthStatus($target, $event->channel) |
@@ -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 | |
@@ -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 |
@@ -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 | { |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | ' -n 1 -i '. |
91 | 91 | $ttl. |
92 | 92 | ' -w '. |
93 | - $timeout * 1000 . |
|
93 | + $timeout * 1000. |
|
94 | 94 | ' '. |
95 | 95 | $host; |
96 | 96 | } elseif (strtoupper(PHP_OS) === 'DARWIN') { |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $output = array_values(array_filter($output)); |
127 | 127 | |
128 | 128 | // If the result line in the output is not empty, parse it. |
129 | - if (! empty($output[1])) { |
|
129 | + if (!empty($output[1])) { |
|
130 | 130 | // Search for a 'time' value in the result line. |
131 | 131 | $response = preg_match( |
132 | 132 | "/time(?:=|<)(?<time>[\.0-9]+)(?:|\s)ms/", |
@@ -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 | { |