| Total Complexity | 20 |
| Total Lines | 97 |
| Duplicated Lines | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | class Plateform |
||
| 14 | { |
||
| 15 | const OS_UNKNOWN = 1; |
||
| 16 | const OS_WIN = 2; |
||
| 17 | const OS_LINUX = 3; |
||
| 18 | const OS_OSX = 4; |
||
| 19 | |||
| 20 | protected static $pharPath; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Running from Phar or not? |
||
| 24 | * |
||
| 25 | * @return bool |
||
| 26 | */ |
||
| 27 | public static function isPhar(): bool |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Returns the full path on disk to the currently executing Phar archive. |
||
| 40 | * |
||
| 41 | * @return string |
||
| 42 | */ |
||
| 43 | public static function getPharPath(): string |
||
| 44 | { |
||
| 45 | if (!isset(self::$pharPath)) { |
||
| 46 | self::isPhar(); |
||
| 47 | } |
||
| 48 | |||
| 49 | return self::$pharPath; |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * Whether the host machine is running a Windows OS. |
||
| 54 | * |
||
| 55 | * @return bool |
||
| 56 | */ |
||
| 57 | public static function isWindows(): bool |
||
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Opens a URL in the system default browser. |
||
| 64 | * |
||
| 65 | * @param string $url |
||
| 66 | * |
||
| 67 | * @return void |
||
| 68 | */ |
||
| 69 | public static function openBrowser($url): void |
||
| 80 | } |
||
| 81 | } |
||
| 82 | } |
||
| 83 | |||
| 84 | /** |
||
| 85 | * Search for system OS in PHP_OS constant. |
||
| 86 | * |
||
| 87 | * @return int |
||
| 88 | */ |
||
| 89 | public static function getOS(): int |
||
| 113 |
The
breakstatement is not necessary if it is preceded for example by areturnstatement:If you would like to keep this construct to be consistent with other
casestatements, you can safely mark this issue as a false-positive.