| Conditions | 6 |
| Paths | 5 |
| Total Lines | 23 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 6 | ||
| Bugs | 3 | Features | 0 |
| 1 | <?php |
||
| 15 | public static function getTokenFromFile($file) |
||
| 16 | { |
||
| 17 | if ( ! file_exists($file)) { |
||
| 18 | return null; |
||
| 19 | } |
||
| 20 | |||
| 21 | foreach (file($file) as $line) { |
||
| 22 | |||
| 23 | if ($token = self::_parseLineForToken($line)) { |
||
| 24 | return $token; |
||
| 25 | } |
||
| 26 | } |
||
| 27 | |||
| 28 | return null; |
||
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @param string $line |
||
| 33 | * @return bool |
||
| 34 | */ |
||
| 35 | protected static function _parseLineForToken($line) |
||
| 36 | { |
||
| 37 | if (empty(strstr($line, self::TOKEN_NAME))) { |
||
| 38 | return false; |
||
| 49 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.