Completed
Push — master ( 567ea1...6214df )
by Igor
05:17
created

NewsQuery   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A active() 0 5 1
A blocked() 0 5 1
1
<?php
2
3
namespace app\models\query;
4
5
use yii\db\ActiveQuery;
6
use app\models\News;
7
8
/**
9
 * ActiveQuery for News
10
 */
11
class NewsQuery extends ActiveQuery
12
{
13
    /**
14
     * Select only active
15
     *
16
     * @return yii\db\ActiveQuery
17
     */
18
    public function active()
19
    {
20
        $this->andWhere(['status' => News::STATUS_ACTIVE]);
21
        return $this;
22
    }
23
24
    /**
25
     * Select only blocked
26
     *
27
     * @return yii\db\ActiveQuery
28
     */
29
    public function blocked()
30
    {
31
        $this->andWhere(['status' => News::STATUS_BLOCKED]);
32
        return $this;
33
    }
34
}
35