TariffQuery   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 23
ccs 0
cts 16
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A byId() 0 4 1
A details() 0 15 1
1
<?php
2
/**
3
 * Finance module for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-finance
6
 * @package   hipanel-module-finance
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\finance\models\query;
12
13
class TariffQuery extends \hiqdev\hiart\ActiveQuery
14
{
15
    public function details()
16
    {
17
        $this->andWhere([
18
            'show_final' => true,
19
            'show_deleted' => true,
20
            'with_resources' => true,
21
            'with_parts' => true,
22
        ]);
23
24
        $this->joinWith(['resources' => function ($query) {
25
            return $query->joinWith('part');
26
        }]);
27
28
        return $this;
29
    }
30
31
    public function byId($id)
32
    {
33
        return $this->andWhere(['id' => $id]);
34
    }
35
}
36