Skip to content

Commit 8edf49c

Browse files
committed
format codes, update some
1 parent aaf2706 commit 8edf49c

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/Sys.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public static function getOutsideIP(): string
233233
{
234234
list($code, $output) = self::run('ip addr | grep eth0');
235235

236-
if ($code === 0 && $output && preg_match('#inet (.*)\/#', $output, $ms)) {
236+
if ($code === 0 && $output && \preg_match('#inet (.*)\/#', $output, $ms)) {
237237
return $ms[1];
238238
}
239239

@@ -252,7 +252,7 @@ public static function getOutsideIP(): string
252252
* not get up to date values on every terminal.
253253
* @return array|boolean An array of ($width, $height) or false when it was not able to determine size.
254254
*/
255-
public static function getScreenSize($refresh = false)
255+
public static function getScreenSize(bool $refresh = false)
256256
{
257257
static $size;
258258
if ($size !== null && !$refresh) {
@@ -264,8 +264,8 @@ public static function getScreenSize($refresh = false)
264264
$stty = [];
265265

266266
if (
267-
exec('stty -a 2>&1', $stty) &&
268-
preg_match('/rows\s+(\d+);\s*columns\s+(\d+);/mi', implode(' ', $stty), $matches)
267+
\exec('stty -a 2>&1', $stty) &&
268+
\preg_match('/rows\s+(\d+);\s*columns\s+(\d+);/mi', implode(' ', $stty), $matches)
269269
) {
270270
return ($size = [$matches[2], $matches[1]]);
271271
}
@@ -283,12 +283,12 @@ public static function getScreenSize($refresh = false)
283283

284284
if (self::isWindows()) {
285285
$output = [];
286-
exec('mode con', $output);
286+
\exec('mode con', $output);
287287

288288
if (isset($output[1]) && strpos($output[1], 'CON') !== false) {
289289
return ($size = [
290-
(int)preg_replace('~\D~', '', $output[3]),
291-
(int)preg_replace('~\D~', '', $output[4])
290+
(int)\preg_replace('~\D~', '', $output[3]),
291+
(int)\preg_replace('~\D~', '', $output[4])
292292
]);
293293
}
294294
}
@@ -300,7 +300,7 @@ public static function getScreenSize($refresh = false)
300300
* @param string $program
301301
* @return int|string
302302
*/
303-
public static function getCpuUsage($program)
303+
public static function getCpuUsage(string $program)
304304
{
305305
if (!$program) {
306306
return -1;
@@ -312,10 +312,10 @@ public static function getCpuUsage($program)
312312
}
313313

314314
/**
315-
* @param $program
315+
* @param string $program
316316
* @return int|string
317317
*/
318-
public static function getMemUsage($program)
318+
public static function getMemUsage(string $program)
319319
{
320320
if (!$program) {
321321
return -1;

0 commit comments

Comments
 (0)