Passed
Push — master ( 90e1a2...59626d )
by Paweł
04:00 queued 11s
created

UpdateAccountJob::execute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 6
nc 2
nop 1
dl 0
loc 10
rs 10
c 0
b 0
f 0
1
<?php /** @noinspection ALL */
2
3
/**
4
 * Created for IG Monitoring.
5
 * User: jakim <[email protected]>
6
 * Date: 11.01.2018
7
 */
8
9
namespace app\jobs;
10
11
12
use app\components\services\AccountUpdater;
13
use app\models\Account;
14
use Yii;
15
use yii\queue\JobInterface;
16
17
class UpdateAccountJob implements JobInterface
18
{
19
    public $id;
20
21
    /**
22
     * @param \yii\queue\Queue $queue
23
     * @throws \yii\base\Exception
24
     * @throws \yii\base\InvalidConfigException
25
     * @throws \Throwable
26
     */
27
    public function execute($queue)
28
    {
29
        $account = Account::findOne($this->id);
30
        if ($account) {
0 ignored issues
show
introduced by
$account is of type yii\db\ActiveRecord, thus it always evaluated to true.
Loading history...
31
32
            $service = Yii::createObject([
33
                'class' => AccountUpdater::class,
34
                'account' => $account,
35
            ]);
36
            $service->run();
37
        }
38
    }
39
}