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

SetAccount::throwExceptionIfAccountIsNotSet()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
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
}