| Conditions | 4 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | 328 | public static function new($value, $toType, ?string $message = null) : self |
|
| 19 | { |
||
| 20 | 328 | if ($message !== null) { |
|
| 21 | 304 | return new self( |
|
| 22 | 304 | sprintf( |
|
| 23 | 4 | "Could not convert database value to '%s' as an error was triggered by the unserialization: '%s'", |
|
| 24 | 304 | $toType, |
|
| 25 | 304 | $message |
|
| 26 | ) |
||
| 27 | ); |
||
| 28 | } |
||
| 29 | |||
| 30 | 299 | return new self( |
|
| 31 | 299 | sprintf( |
|
| 32 | 24 | 'Could not convert database value "%s" to Doctrine Type %s', |
|
| 33 | 299 | is_string($value) && strlen($value) > 32 ? substr($value, 0, 20) . '...' : $value, |
|
| 34 | 299 | $toType |
|
| 35 | ) |
||
| 39 |