Completed
Push — master ( 077f63...ceb768 )
by Andrii
02:53
created

ActiveQuery   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 24
ccs 0
cts 10
cp 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setRepository() 0 4 1
A all() 0 4 2
A one() 0 4 2
A getDb() 0 4 1
1
<?php
2
3
namespace hiapi\repositories;
4
5
use Yii;
6
7
class ActiveQuery extends \yii\db\ActiveQuery
8
{
9
    public $repository;
10
11
    public function setRepository($value)
12
    {
13
        $this->repository = $value;
14
    }
15
16
    public function all($db = null)
17
    {
18
        return parent::all($db ?: $this->getDb());
19
    }
20
21
    public function one($db = null)
22
    {
23
        return parent::one($db ?: $this->getDb());
0 ignored issues
show
Bug Compatibility introduced by
The expression parent::one($db ?: $this->getDb()); of type yii\db\ActiveRecord|array|null adds the type yii\db\ActiveRecord to the return on line 23 which is incompatible with the return type declared by the interface yii\db\QueryInterface::one of type array|boolean.
Loading history...
24
    }
25
26
    public function getDb()
27
    {
28
        return Yii::$app->getDb();
29
    }
30
}
31