| Conditions | 4 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 4 |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 7 | 5 | public static function validateStringable($name, $value) |
|
| 8 | 5 | { |
|
| 9 | 5 | if ($value instanceof \CURLFile) { |
|
| 10 | 2 | if (false === $value = @file_get_contents($value->getFilename())) { |
|
| 11 | 1 | $error = error_get_last(); |
|
| 12 | 1 | throw new \RuntimeException($error['message']); |
|
| 13 | } |
||
| 14 | 1 | return base64_encode($value); |
|
| 15 | } |
||
| 16 | 4 | if (false === $result = filter_var($value)) { |
|
| 17 | 2 | $type = gettype($value); |
|
| 18 | 2 | throw new \InvalidArgumentException("\"$name\" must be stringable, $type given."); |
|
| 19 | } |
||
| 20 | 2 | return (string)$value; |
|
| 21 | } |
||
| 22 | |||
| 50 |