| Conditions | 5 |
| Paths | 5 |
| Total Lines | 20 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 28 | public function collectData($attributes = null) |
||
| 29 | { |
||
| 30 | $data = []; |
||
| 31 | foreach ($this->models as $model) { |
||
| 32 | if ($this->dataCollector instanceof Closure) { |
||
| 33 | list($key, $row) = call_user_func($this->dataCollector, $model, $this); |
||
| 34 | } else { |
||
| 35 | $key = $model->getPrimaryKey(); |
||
| 36 | $row = $model->getAttributes($this->isConsistent() ? $attributes : $model->attributes); |
||
| 37 | $row['recordModel'] = $model; |
||
| 38 | } |
||
| 39 | |||
| 40 | if ($key) { |
||
| 41 | $data[$key] = $row; |
||
| 42 | } else { |
||
| 43 | $data[] = $row; |
||
| 44 | } |
||
| 45 | } |
||
| 46 | |||
| 47 | return $data; |
||
| 48 | } |
||
| 73 |