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

UpdateAccountJob   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 10 2
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
}