@@ -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) |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | ($ss = $this->uptimeInSeconds($this->database)); |
26 | 26 | |
27 | 27 | return $this->makeResult( |
28 | - ! $rebooted, |
|
28 | + !$rebooted, |
|
29 | 29 | $this->makeMessage($current, $this->database) |
30 | 30 | ); |
31 | 31 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | throw new DomainException((string) $error); |
45 | 45 | } |
46 | 46 | |
47 | - return (! is_array($system_string) || empty($system_string)) |
|
47 | + return (!is_array($system_string) || empty($system_string)) |
|
48 | 48 | ? '' |
49 | 49 | : $system_string[0]; |
50 | 50 | } |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | protected function normalizeMatches($matches) |
70 | 70 | { |
71 | 71 | return collect($matches) |
72 | - ->filter(function ($item, $key) { |
|
73 | - return ! is_numeric($key); |
|
72 | + ->filter(function($item, $key) { |
|
73 | + return !is_numeric($key); |
|
74 | 74 | }) |
75 | - ->map(function ($item, $key) { |
|
75 | + ->map(function($item, $key) { |
|
76 | 76 | $return = $item[0]; |
77 | 77 | |
78 | 78 | if (Str::startsWith($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) |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | ($ss = $this->uptimeInSeconds($this->database)); |
26 | 26 | |
27 | 27 | return $this->makeResult( |
28 | - ! $rebooted, |
|
28 | + !$rebooted, |
|
29 | 29 | $this->makeMessage($current, $this->database) |
30 | 30 | ); |
31 | 31 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | throw new DomainException((string) $error); |
45 | 45 | } |
46 | 46 | |
47 | - return (! is_array($system_string) || empty($system_string)) |
|
47 | + return (!is_array($system_string) || empty($system_string)) |
|
48 | 48 | ? '' |
49 | 49 | : $system_string[0]; |
50 | 50 | } |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | protected function normalizeMatches($matches) |
70 | 70 | { |
71 | 71 | return collect($matches) |
72 | - ->filter(function ($item, $key) { |
|
73 | - return ! is_numeric($key); |
|
72 | + ->filter(function($item, $key) { |
|
73 | + return !is_numeric($key); |
|
74 | 74 | }) |
75 | - ->map(function ($item, $key) { |
|
75 | + ->map(function($item, $key) { |
|
76 | 76 | $return = $item[0]; |
77 | 77 | |
78 | 78 | if (Str::startsWith($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/", |
@@ -30,6 +30,9 @@ |
||
30 | 30 | return $this->makeHealthyResult(); |
31 | 31 | } |
32 | 32 | |
33 | + /** |
|
34 | + * @param double $free |
|
35 | + */ |
|
33 | 36 | public function isEnough($free, $minimum) |
34 | 37 | { |
35 | 38 | return $free > human_to_bytes($minimum); |
@@ -15,7 +15,7 @@ |
||
15 | 15 | { |
16 | 16 | $free = disk_free_space($this->target->path); |
17 | 17 | |
18 | - if (! $this->isEnough($free, $this->target->minimum)) { |
|
18 | + if (!$this->isEnough($free, $this->target->minimum)) { |
|
19 | 19 | return $this->makeResult( |
20 | 20 | false, |
21 | 21 | sprintf( |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @param $url |
91 | 91 | * @param $ssl |
92 | - * @return mixed|\Psr\Http\Message\ResponseInterface |
|
92 | + * @return \Psr\Http\Message\ResponseInterface |
|
93 | 93 | * @throws \GuzzleHttp\Exception\GuzzleException |
94 | 94 | */ |
95 | 95 | private function fetchResponse($url, $ssl) |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * Make a url with a proper scheme. |
161 | 161 | * |
162 | 162 | * @param $url |
163 | - * @param $secure |
|
163 | + * @param boolean $secure |
|
164 | 164 | * @return mixed |
165 | 165 | */ |
166 | 166 | private function makeUrlWithScheme($url, $secure) |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | * Send a request and get the result. |
189 | 189 | * |
190 | 190 | * @param $url |
191 | - * @param $ssl |
|
191 | + * @param boolean $ssl |
|
192 | 192 | * @return bool |
193 | 193 | * @internal param $response |
194 | 194 | */ |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $this->secure |
46 | 46 | ); |
47 | 47 | |
48 | - if (! $healthy) { |
|
48 | + if (!$healthy) { |
|
49 | 49 | return $this->makeResult($healthy, $message); |
50 | 50 | } |
51 | 51 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | */ |
180 | 180 | private function onStatsCallback() |
181 | 181 | { |
182 | - return function (TransferStats $stats) { |
|
182 | + return function(TransferStats $stats) { |
|
183 | 183 | $this->totalTime = $stats->getTransferTime(); |
184 | 184 | }; |
185 | 185 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | { |
197 | 197 | return |
198 | 198 | $this->fetchResponse($url, $ssl)->getStatusCode() == 200 && |
199 | - ! $this->requestTimedout(); |
|
199 | + !$this->requestTimedout(); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
@@ -28,7 +28,8 @@ |
||
28 | 28 | * Get hostname and IP. |
29 | 29 | * |
30 | 30 | * @param $hostname |
31 | - * @return mixed |
|
31 | + * @param boolean $ipAdress |
|
32 | + * @return string |
|
32 | 33 | */ |
33 | 34 | protected function hosnameAndIp($hostname, $ipAdress) |
34 | 35 | { |
@@ -74,7 +74,7 @@ |
||
74 | 74 | */ |
75 | 75 | protected function portIsNotConnectable($ipAddress) |
76 | 76 | { |
77 | - return ! $this->portCheck( |
|
77 | + return !$this->portCheck( |
|
78 | 78 | $ipAddress, |
79 | 79 | $this->target->port, |
80 | 80 | $this->target->timeout ?? 1 |