| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | 5 | public function enabled($enabled = true) |
|
| 14 | { |
||
| 15 | /** @var ActiveQuery|mixed $this */ |
||
| 16 | 5 | if (!is_null($enabled)) { |
|
| 17 | 5 | if (is_null($this->from)) { |
|
| 18 | /** @var Oauth2ActiveRecordInterface $modelClass */ |
||
| 19 | 4 | $modelClass = $this->modelClass; |
|
| 20 | 4 | $table = $modelClass::tableName(); |
|
| 21 | } else { |
||
| 22 | 1 | $table = array_key_first($this->from); |
|
| 23 | } |
||
| 24 | 5 | $this->andWhere([ "$table.enabled" => $enabled]); |
|
| 25 | } |
||
| 26 | |||
| 27 | 5 | return $this; |
|
| 28 | } |
||
| 30 |