Issues (76)

components/traits/SetAccountTrait.php (1 issue)

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 SetAccountTrait
15
{
16
    /**
17
     * @var \app\models\Account
18
     */
19
    public $account;
20
21
    protected function throwExceptionIfAccountIsNotSet()
22
    {
23
        if (!$this->account instanceof Account) {
0 ignored issues
show
$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
}