| Conditions | 8 |
| Paths | 6 |
| Total Lines | 23 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 72 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 28 | public function isCLI() |
||
| 29 | { |
||
| 30 | if (defined('STDIN')) { |
||
| 31 | return true; |
||
| 32 | } |
||
| 33 | |||
| 34 | if (php_sapi_name() === 'cli') { |
||
| 35 | return true; |
||
| 36 | } |
||
| 37 | |||
| 38 | if (array_key_exists('SHELL', $_ENV)) { |
||
| 39 | return true; |
||
| 40 | } |
||
| 41 | |||
| 42 | if (empty($_SERVER['REMOTE_ADDR']) and !isset($_SERVER['HTTP_USER_AGENT']) and count($_SERVER['argv']) > 0) { |
||
| 43 | return true; |
||
| 44 | } |
||
| 45 | |||
| 46 | if (!array_key_exists('REQUEST_METHOD', $_SERVER)) { |
||
| 47 | return true; |
||
| 48 | } |
||
| 49 | |||
| 50 | return false; |
||
| 51 | } |
||
| 73 |