| Conditions | 1 |
| Paths | 1 |
| Total Lines | 13 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 1 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | 6 | protected function formatAttachRecord($key, $value, $attributes, $hasTimestamps) |
|
| 19 | { |
||
| 20 | 6 | [$id, $attributes] = $this->extractAttachIdAndAttributes($key, $value, $attributes); |
|
| 21 | |||
| 22 | /** |
||
| 23 | * When attaching multiple models with pivot data PHP will cast a numeric-string array key to an integer |
||
| 24 | * By setting the type here we recast it to the keyType set on the model. |
||
| 25 | */ |
||
| 26 | 6 | settype($id, $this->related->getKeyType()); |
|
| 27 | |||
| 28 | 6 | return array_merge( |
|
| 29 | 6 | $this->baseAttachRecord($id, $hasTimestamps), |
|
|
|
|||
| 30 | 6 | $this->castAttributes($attributes), |
|
| 31 | 6 | ); |
|
| 34 |