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

ContactListContactsAccessor::read()   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
use flipbox\hubspot\services\resources\ContactListContacts;
14
15
/**
16
 * @author Flipbox Factory <[email protected]>
17
 * @since 1.0.0
18
 */
19
class ContactListContactsAccessor extends ObjectAccessor
20
{
21
    /**
22
     * @inheritdoc
23
     */
24
    public function init()
25
    {
26
        $this->transformer = ContactListContacts::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()->getContactListContacts()->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