Conditions | 3 |
Paths | 3 |
Total Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 3.0261 |
Changes | 0 |
1 | <?php |
||
28 | 83 | protected function createModel($data) |
|
|
|||
29 | { |
||
30 | 83 | if (!empty($data['$err'])) |
|
31 | { |
||
32 | throw new ManganException(sprintf("There is an error in query: %s", $data['$err'])); |
||
33 | } |
||
34 | |||
35 | // By default create instances of same |
||
36 | // type as provided model |
||
37 | 83 | $model = $this->getModel(); |
|
38 | |||
39 | // For non homogeneous collections class |
||
40 | // need to be taken from data, not defined |
||
41 | // by model |
||
42 | 83 | if(ManganMeta::create($model)->type()->homogenous === false) |
|
43 | { |
||
44 | 5 | $model = null; |
|
45 | } |
||
46 | 83 | return RawArray::toModel($data, $model); |
|
47 | } |
||
48 | } |