Completed
Push — master ( e78df8...6c6364 )
by Nate
26:21 queued 16:45
created

ContactListMutator::update()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 2
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://flipboxfactory.com/software/hubspot/license
6
 * @link       https://www.flipboxfactory.com/software/hubspot/
7
 */
8
9
namespace flipbox\hubspot\criteria;
10
11
use flipbox\ember\helpers\ObjectHelper;
12
use flipbox\hubspot\HubSpot;
13
14
/**
15
 * @author Flipbox Factory <[email protected]>
16
 * @since 1.0.0
17
 */
18
class ContactListMutator extends ObjectMutator
19
{
20
    /**
21
     * @param array $config
22
     * @param null $source
23
     * @return mixed
24
     * @throws \yii\base\InvalidConfigException
25
     */
26
    public function create(array $config = [], $source = null)
27
    {
28
        $this->prepare($config);
29
        return HubSpot::getInstance()->getResources()->getContactLists()->create($this, $source);
30
    }
31
32
    /**
33
     * @param array $config
34
     * @param null $source
35
     * @return mixed
36
     * @throws \yii\base\InvalidConfigException
37
     */
38
    public function update(array $config = [], $source = null)
39
    {
40
        $this->prepare($config);
41
        return HubSpot::getInstance()->getResources()->getContactLists()->update($this, $source);
42
    }
43
44
    /**
45
     * @param array $config
46
     * @param null $source
47
     * @return mixed
48
     * @throws \yii\base\InvalidConfigException
49
     */
50
    public function delete(array $config = [], $source = null)
51
    {
52
        $this->prepare($config);
53
        return HubSpot::getInstance()->getResources()->getContactLists()->delete($this, $source);
54
    }
55
56
    /**
57
     * @param array $config
58
     * @param null $source
59
     * @return mixed
60
     * @throws \yii\base\InvalidConfigException
61
     */
62
    public function upsert(array $config = [], $source = null)
63
    {
64
        $this->prepare($config);
65
        return HubSpot::getInstance()->getResources()->getContactLists()->upsert($this, $source);
66
    }
67
68
    /**
69
     * @inheritdoc
70
     */
71
    protected function prepare(array $criteria = [])
72
    {
73
        ObjectHelper::populate(
74
            $this,
75
            $criteria
76
        );
77
    }
78
}
79