| Conditions | 5 |
| Paths | 1 |
| Total Lines | 25 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 0 | ||
| 1 | <?php |
||
| 32 | public function rules() |
||
| 33 | { |
||
| 34 | return [ |
||
| 35 | ['select', 'safe'], |
||
| 36 | [['where', 'filter'], 'safe'], |
||
| 37 | [['page'], 'integer'], |
||
| 38 | ['limit', function () { |
||
| 39 | if (empty($this->limit)) { |
||
| 40 | return; |
||
| 41 | } |
||
| 42 | |||
| 43 | if (mb_strtolower($this->limit) === 'all') { |
||
| 44 | $this->limit = 'all'; |
||
| 45 | return; |
||
| 46 | } |
||
| 47 | |||
| 48 | if ($this->limit < 1 || $this->limit > 1000) { |
||
| 49 | $this->addError('limit', 'Limit must be between 1 and 1000'); |
||
| 50 | return; |
||
| 51 | } |
||
| 52 | }], |
||
| 53 | [['with', 'include'], 'each', 'rule' => [RefValidator::class]], |
||
| 54 | [['count'], 'boolean'] |
||
| 55 | ]; |
||
| 56 | } |
||
| 57 | |||
| 70 |