Passed
Push — master ( 05bc1d...1bc3c7 )
by Tõnis
02:04
created

Quota::getEndUrls()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace dameter\abstracts\models;
4
5
use dameter\abstracts\WithLanguageSettingsModel;
6
7
8
/**
9
 * Class Quota
10
 * @property integer $quota_id
11
 * @property string $conditions
12
 *
13
 * @property QuotaText[] $endMessages
14
 * @property QuotaText[] $endUrls
15
 *
16
 * @package dameter\abstract\models
17
 * @author Tõnis Ormisson <[email protected]>
18
 */
19
class Quota extends WithLanguageSettingsModel
20
{
21
    public static $settingsClass = QuotaText::class;
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function rules()
27
    {
28
        return array_merge(parent::rules(), [
29
            [['conditions'], 'string'],
30
        ]);
31
    }
32
33
    /**
34
     * @return \yii\db\ActiveQuery
35
     */
36
    public function getEndMessages()
37
    {
38
        $query = $this->getTexts();
39
        return $query->andWhere(['type_id' => QuotaText::TYPE_END_MESSAGE]);
40
    }
41
42
    /**
43
     * @return \yii\db\ActiveQuery
44
     */
45
    public function getEndUrls()
46
    {
47
        $query = $this->getTexts();
48
        return $query->andWhere(['type_id' => QuotaText::TYPE_END_URL]);
49
    }
50
51
52
}