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