Completed
Push — master ( c22208...64acfb )
by Igor
04:17
created

NewsQuery   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

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
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;
6
use yii\db\ActiveQuery;
7
use app\models\News;
8
9
/**
10
 * ActiveQuery for News
11
 */
12
class NewsQuery extends ActiveQuery
13
{
14
    /**
15
     * Select only active
16
     *
17
     * @return yii\db\ActiveQuery
18
     */
19
    public function active()
20
    {
21
        $this->andWhere(['status' => News::STATUS_ACTIVE]);
22
        return $this;
23
    }
24
25
    /**
26
     * Select only blocked
27
     *
28
     * @return yii\db\ActiveQuery
29
     */
30
    public function blocked()
31
    {
32
        $this->andWhere(['status' => News::STATUS_BLOCKED]);
33
        return $this;
34
    }
35
}
36