SetTagTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 11
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A throwExceptionIfTagIsEmpty() 0 4 2
1
<?php
2
/**
3
 * Created for IG Monitoring.
4
 * User: jakim <[email protected]>
5
 * Date: 2019-02-13
6
 */
7
8
namespace app\components\traits;
9
10
11
use app\models\Tag;
12
use yii\base\InvalidConfigException;
13
14
trait SetTagTrait
15
{
16
    /**
17
     * @var \app\models\Tag
18
     */
19
    public $tag;
20
21
    protected function throwExceptionIfTagIsEmpty()
22
    {
23
        if (!$this->tag instanceof Tag) {
0 ignored issues
show
introduced by
$this->tag is always a sub-type of app\models\Tag.
Loading history...
24
            throw new InvalidConfigException('Property \'tag\' must be set and be type of \'\app\models\Tag\'.');
25
        }
26
    }
27
}