diff --git a/System/OperatingSystem.php b/System/OperatingSystem.php index e0293b5c8..d46bc8bdb 100644 --- a/System/OperatingSystem.php +++ b/System/OperatingSystem.php @@ -40,15 +40,14 @@ final class OperatingSystem */ public static function getSystem() : int { - switch (PHP_OS) { - case stristr(PHP_OS, 'DAR'): - return SystemType::OSX; - case stristr(PHP_OS, 'WIN'): - return SystemType::WIN; - case stristr(PHP_OS, 'LINIX'): - return SystemType::LINUX; - default: - return SystemType::UNKNOWN; - } + if(stristr(PHP_OS, 'DAR') !== false) { + return SystemType::OSX; + } elseif(stristr(PHP_OS, 'WIN') !== false) { + return SystemType::WIN; + } elseif(stristr(PHP_OS, 'LINIX') !== false) { + return SystemType::LINUX; + } + + return SystemType::UNKNOWN; } } \ No newline at end of file diff --git a/System/SystemUtils.php b/System/SystemUtils.php index f05f8f60f..07a51fbac 100644 --- a/System/SystemUtils.php +++ b/System/SystemUtils.php @@ -112,11 +112,11 @@ class SystemUtils { $cpuusage = 0; - if (stristr(PHP_OS, 'WIN')) { + if (stristr(PHP_OS, 'WIN') !== false) { exec('wmic cpu get LoadPercentage', $cpuusage); $cpuusage = $cpuusage[1]; - } elseif (stristr(PHP_OS, 'LINUX')) { - $cpuusage = \sys_getloadavg()[0]; + } elseif (stristr(PHP_OS, 'LINUX') !== false) { + $cpuusage = \sys_getloadavg()[0] * 100; } return (int) $cpuusage;