Passed
Push — master ( b2168e...f1daef )
by Paweł
03:26
created

SetAccount   A

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