| Conditions | 5 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 34 | 82 | public static function filenameExists(string $value, string $message = '') |
|
| 35 | { |
||
| 36 | 82 | if ($value !== realpath($value)) { |
|
| 37 | 18 | $format = '%s must contain the absolute path and file'; |
|
| 38 | 18 | $message = sprintf($message ?: $format, self::valueToString($value)); |
|
| 39 | 18 | self::reportInvalidArgument($message); |
|
| 40 | } |
||
| 41 | |||
| 42 | 64 | if (!is_file($value)) { |
|
| 43 | 3 | $format = '%s is not a regular file'; |
|
| 44 | 3 | $message = sprintf($message ?: $format, self::valueToString($value)); |
|
| 45 | 3 | self::reportInvalidArgument($message); |
|
| 46 | } |
||
| 47 | |||
| 48 | 61 | return null; |
|
| 49 | } |
||
| 51 |