Completed
Push — develop ( 639fa1...b48ec5 )
by Nate
02:32
created

CompanyContactsCriteria   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 30
c 0
b 0
f 0
ccs 0
cts 8
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A fetch() 0 9 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\hubspot\HubSpot;
12
use flipbox\hubspot\services\resources\CompanyContacts;
13
use flipbox\hubspot\transformers\collections\DynamicTransformerCollection;
14
use flipbox\hubspot\transformers\collections\TransformerCollectionInterface;
15
use flipbox\hubspot\transformers\DynamicModelSuccess;
16
17
/**
18
 * @author Flipbox Factory <[email protected]>
19
 * @since 1.0.0
20
 */
21
class CompanyContactsCriteria extends ObjectCriteria
22
{
23
    /**
24
     * @inheritdoc
25
     */
26
    protected $transformer = [
27
        'class' => DynamicTransformerCollection::class,
28
        'handle' => CompanyContacts::HUBSPOT_RESOURCE,
29
        'transformers' => [
30
            TransformerCollectionInterface::SUCCESS_KEY => [
31
                'class' => DynamicModelSuccess::class,
32
                'resource' => CompanyContacts::HUBSPOT_RESOURCE
33
            ]
34
        ]
35
    ];
36
37
    /**
38
     * @inheritdoc
39
     * @throws \yii\base\InvalidConfigException
40
     */
41
    public function fetch(array $config = [])
42
    {
43
        $this->prepare($config);
44
45
        return HubSpot::getInstance()
46
            ->getResources()
47
            ->getCompanyContacts()
48
            ->read($this);
49
    }
50
}
51