Improved working with OS for serverType

This commit is contained in:
mattpass
2020-06-27 16:27:25 +01:00
parent c201ed4471
commit df5d148ac5
6 changed files with 14 additions and 19 deletions

View File

@@ -14,20 +14,15 @@ class System
}
}
const OS_UNKNOWN = 'Linux';
const OS_WIN = 'Windows';
const OS_LINUX = 'Linux';
const OS_OSX = 'Mac';
/**
* @return int
* @return string
*/
public function getOS() {
switch (true) {
case stristr(PHP_OS, 'DAR'): return self::OS_OSX;
case stristr(PHP_OS, 'WIN'): return self::OS_WIN;
case stristr(PHP_OS, 'LINUX'): return self::OS_LINUX;
default : return self::OS_UNKNOWN;
case stristr(PHP_OS, 'DAR'): return 'Mac';
case stristr(PHP_OS, 'WIN'): return 'Windows';
case stristr(PHP_OS, 'LINUX'): return 'Linux';
default : return 'Linux';
}
}