| 1 | <?php |
||
| 5 | class SystemTable |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * Map relating possible values of `PHP_OS` and widely known OS groups |
||
| 9 | * |
||
| 10 | * Values should be declared in lowercase. |
||
| 11 | * |
||
| 12 | * @link http://stackoverflow.com/questions/738823/possible-values-for-php-os |
||
| 13 | * @link http://en.wikipedia.org/wiki/Uname#Table_of_standard_uname_output |
||
| 14 | * @link https://github.com/php/php-src/blob/5b1f6caaf0574cd72396b1b4c671bae82557c4b4/configure.in |
||
| 15 | */ |
||
| 16 | protected static $map = [ |
||
| 17 | 'Linux' => [ 'linux', 'cygwin', 'linux-armv71', 'linux2', 'unix', 'sunos'], // `cat /proc/uptime` |
||
| 18 | 'Darwin' => [ 'darwin', 'mac', 'osx'], // `sysctl kern.boottime` |
||
| 19 | 'BSD' => [ 'freebsd', 'openbsd', 'netbsd', 'bsd' ], // `sysctl kern.boottime` |
||
| 20 | 'Windows' => [ 'win32', 'winnt', 'windows' ], // `wmic os get lastbootuptime` |
||
| 21 | 'OpenVMS' => [ 'openvms' ] // `show system/noprocess` |
||
| 22 | ]; |
||
| 23 | |||
| 24 | public static function getSystemIdentifier($system) |
||
| 33 | |||
| 34 | public static function getMap() |
||
| 38 | |||
| 39 | } |
||
| 40 |