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