| Conditions | 4 |
| Paths | 4 |
| Total Lines | 25 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 68 | protected function getCVVersion() |
||
| 69 | { |
||
| 70 | if (!extension_loaded('pcntl')) { |
||
| 71 | return null; |
||
| 72 | } |
||
| 73 | |||
| 74 | $proc = proc_open( |
||
| 75 | 'git describe --always', |
||
| 76 | [ |
||
| 77 | 1 => ['pipe','w'], |
||
| 78 | ], |
||
| 79 | $pipes |
||
| 80 | ); |
||
| 81 | if ($proc) { |
||
| 82 | $stdout = stream_get_contents($pipes[1]); |
||
| 83 | fclose($pipes[1]); |
||
| 84 | |||
| 85 | $exitCode = proc_close($proc); |
||
| 86 | if ($exitCode === 0) { |
||
| 87 | return $stdout; |
||
| 88 | } |
||
| 89 | } |
||
| 90 | |||
| 91 | return null; |
||
| 92 | } |
||
| 93 | |||
| 114 |
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
stringvalues, the empty string''is a special case, in particular the following results might be unexpected: