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

CompanyContactsMutator   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 6

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 2
cbo 6
dl 0
loc 67
ccs 0
cts 25
cp 0
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getCompanyId() 0 4 1
A getContactId() 0 4 1
A add() 0 5 1
A remove() 0 5 1
A prepare() 0 7 1
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
use yii\base\BaseObject;
14
15
/**
16
 * @author Flipbox Factory <[email protected]>
17
 * @since 1.0.0
18
 */
19
class CompanyContactsMutator extends BaseObject implements CompanyContactsMutatorInterface
20
{
21
    use traits\TransformerCollectionTrait,
22
        traits\ConnectionTrait,
23
        traits\CacheTrait;
24
25
    /**
26
     * @var string
27
     */
28
    public $companyId;
29
30
    /**
31
     * @var string
32
     */
33
    public $contactId;
34
35
    /**
36
     * @return string
37
     */
38
    public function getCompanyId(): string
39
    {
40
        return (string)$this->companyId;
41
    }
42
43
    /**
44
     * @return string
45
     */
46
    public function getContactId(): string
47
    {
48
        return (string)$this->contactId;
49
    }
50
51
    /**
52
     * @param array $config
53
     * @param null $source
54
     * @return mixed
55
     * @throws \yii\base\InvalidConfigException
56
     */
57
    public function add(array $config = [], $source = null)
58
    {
59
        $this->prepare($config);
60
        return HubSpot::getInstance()->getResources()->getCompanyContacts()->add($this, $source);
61
    }
62
63
    /**
64
     * @param array $config
65
     * @param null $source
66
     * @return mixed
67
     * @throws \yii\base\InvalidConfigException
68
     */
69
    public function remove(array $config = [], $source = null)
70
    {
71
        $this->prepare($config);
72
        return HubSpot::getInstance()->getResources()->getCompanyContacts()->remove($this, $source);
73
    }
74
75
    /**
76
     * @inheritdoc
77
     */
78
    protected function prepare(array $criteria = [])
79
    {
80
        ObjectHelper::populate(
81
            $this,
82
            $criteria
83
        );
84
    }
85
}
86