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

CompanyContactsAccessor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 4
dl 0
loc 34
ccs 0
cts 17
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 5 1
A read() 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 flipbox\hubspot\services\resources\CompanyContacts;
14
15
/**
16
 * @author Flipbox Factory <[email protected]>
17
 * @since 1.0.0
18
 */
19
class CompanyContactsAccessor extends ObjectAccessor
20
{
21
    /**
22
     * @inheritdoc
23
     */
24
    public function init()
25
    {
26
        $this->transformer = CompanyContacts::defaultTransformer();
27
        parent::init();
28
    }
29
30
    /**
31
     * @param array $config
32
     * @param null $source
33
     * @return mixed
34
     * @throws \yii\base\InvalidConfigException
35
     */
36
    public function read(array $config = [], $source = null)
37
    {
38
        $this->prepare($config);
39
        return HubSpot::getInstance()->getResources()->getCompanyContacts()->read($this, $source);
40
    }
41
42
    /**
43
     * @inheritdoc
44
     */
45
    protected function prepare(array $criteria = [])
46
    {
47
        ObjectHelper::populate(
48
            $this,
49
            $criteria
50
        );
51
    }
52
}
53