Completed
Push — develop ( 3644a8...72e19e )
by Nate
06:59
created

UpsertTimelineEvent::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 0
cts 9
cp 0
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace flipbox\hubspot\queue\jobs;
4
5
use Craft;
6
use craft\db\Query;
7
use craft\elements\db\ElementQuery;
8
use craft\queue\BaseJob;
9
use flipbox\hubspot\connections\IntegrationConnectionInterface;
10
use flipbox\hubspot\HubSpot;
11
12
class UpsertTimelineEvent extends BaseJob
13
{
14
    /**
15
     * @var string
16
     */
17
    public $id;
18
19
    /**
20
     * @var string
21
     */
22
    public $typeId;
23
24
    /**
25
     * @var array
26
     */
27
    public $payload = [];
28
29
    /**
30
     * @var IntegrationConnectionInterface
31
     */
32
    public $connection;
33
34
    /**
35
     * @param \craft\queue\QueueInterface|\yii\queue\Queue $queue
36
     * @return bool|false|string
37
     * @throws \yii\base\InvalidConfigException
38
     */
39
    public function execute($queue)
40
    {
41
        HubSpot::getInstance()->getResources()->getTimelineEvents()->upsert(
42
            $this->id,
43
            $this->typeId,
44
            $this->payload,
45
            $this->connection
46
        );
47
    }
48
49
    /**
50
     * @inheritdoc
51
     */
52
    protected function defaultDescription(): string
53
    {
54
        return Craft::t('hubspot', 'Create/Update HubSpot timeline event.');
55
    }
56
}
57