| Conditions | 7 |
| Paths | 10 |
| Total Lines | 31 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 20.7821 |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | 5 | public static function build( |
|
| 23 | BaseFindYmlInterface $class, |
||
| 24 | ActiveDataProvider $dataProvider = null, |
||
| 25 | ActiveQuery $query = null, |
||
| 26 | $findParams = [] |
||
| 27 | ) |
||
| 28 | { |
||
| 29 | 5 | if (!empty($dataProvider)) { |
|
| 30 | 1 | if ($dataProvider instanceof ActiveDataProvider) { |
|
| 31 | 1 | $reader = new DataProviderReader($dataProvider); |
|
| 32 | 1 | } elseif ($dataProvider === true) { |
|
| 33 | if (!$query) { |
||
| 34 | $query = $class::findYml($findParams); |
||
| 35 | } |
||
| 36 | $reader = new DataProviderReader( |
||
| 37 | new ActiveDataProvider([ |
||
| 38 | 'query' => $query, |
||
| 39 | 'pagination' => [ |
||
| 40 | 'pageSize' => 1000, |
||
| 41 | ] |
||
| 42 | ]) |
||
| 43 | ); |
||
| 44 | } |
||
| 45 | 1 | } |
|
| 46 | |||
| 47 | 5 | if (empty($reader)) { |
|
| 48 | 5 | $reader = new QueryReader($query ? : $class::findYml($findParams)); |
|
| 49 | 5 | } |
|
| 50 | |||
| 51 | 5 | return $reader; |
|
| 52 | } |
||
| 53 | } |
||
| 54 |