| Conditions | 1 |
| Paths | 1 |
| Total Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | 2 | public static function from(WriteException $exception) |
|
| 19 | { |
||
| 20 | 2 | preg_match('/^E11000 duplicate key error collection: (.*) index: (.*) dup key: (.*)$/', $exception->getMessage(), $matches); |
|
| 21 | |||
| 22 | 2 | $table = $matches[1] ?? ''; |
|
| 23 | 2 | $index = $matches[2] ?? ''; |
|
| 24 | 2 | $data = $matches[3] ?? ''; |
|
| 25 | |||
| 26 | 2 | return new static($exception->getMessage(), $table, $index, $data, $exception); |
|
| 27 | } |
||
| 28 | } |
||
| 29 |