| Conditions | 5 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | 28 | public static function assertTemplateName(string $value, string $message = '') |
|
| 27 | { |
||
| 28 | 28 | if (basename($value) != $value) { |
|
| 29 | 8 | $format = "%s contains path information ('/', '.', or '..')"; |
|
| 30 | 8 | $message = sprintf($message ?: $format, static::valueToString($value)); |
|
| 31 | 8 | static::reportInvalidArgument($message); |
|
| 32 | } |
||
| 33 | |||
| 34 | 20 | $extension = pathinfo($value, PATHINFO_EXTENSION); |
|
| 35 | |||
| 36 | try { |
||
| 37 | 20 | static::assertTemplateFormat($extension); |
|
|
|
|||
| 38 | 5 | } catch (InvalidArgumentException $e) { |
|
| 39 | 5 | $format = "%s contains an unsupported file extension"; |
|
| 40 | 5 | $message = sprintf($message ?: $format, static::valueToString($value)); |
|
| 41 | 5 | static::reportInvalidArgument($message); |
|
| 42 | } |
||
| 43 | |||
| 44 | 15 | return null; |
|
| 45 | } |
||
| 47 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.