| Conditions | 4 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | public function save($lot, array $data) |
||
| 24 | { |
||
| 25 | $model = self::getModel(); |
||
| 26 | $model->where('lot_id', $lot->id)->delete(); |
||
|
|
|||
| 27 | $insert = []; $i = 0; |
||
| 28 | if (!empty($data)) { |
||
| 29 | foreach ($data as $key1 => $method) { |
||
| 30 | foreach ($method as $key2 => $item) { |
||
| 31 | $insert[$i]['lot_id'] = $lot->id; |
||
| 32 | $insert[$i]['method_id'] = (int)$item; |
||
| 33 | $insert[$i]['method_type'] = $key1; |
||
| 34 | $i++; |
||
| 35 | } |
||
| 36 | |||
| 37 | } |
||
| 38 | $model->insert($insert); |
||
| 39 | } |
||
| 40 | return true; |
||
| 41 | } |
||
| 42 | } |
If you implement
__calland you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__callis implemented by a parent class and only the child class knows which methods exist: