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

NewsQuery::blocked()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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