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

ActiveQuery::one()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
cc 2
eloc 2
nc 1
nop 1
crap 6
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