Completed
Push — master ( f7d62f...5e8002 )
by Matt
02:53
created

ARBGetSubscriptionListRequest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 2
dl 0
loc 48
ccs 19
cts 19
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A setSorting() 0 5 1
A setPaging() 0 5 1
A attachData() 0 10 3
1
<?php
2
3
namespace CommerceGuys\AuthNet;
4
5
use GuzzleHttp\Client;
6
use CommerceGuys\AuthNet\DataTypes\Paging;
7
use CommerceGuys\AuthNet\DataTypes\Sorting;
8
use CommerceGuys\AuthNet\Request\RequestInterface;
9
10
/**
11
 * Use this method to get subscriptions using Automated Recurring Billing.
12
 */
13
class ARBGetSubscriptionListRequest extends ARBSubscriptionRequest
14
{
15
    protected $searchType;
16
17
    protected $sorting;
18
19
    protected $paging;
20
21 1
    public function __construct(
22
        Configuration $configuration,
23
        Client $client,
24
        $searchType
25
    ) {
26 1
        parent::__construct($configuration, $client);
27 1
        $this->searchType = $searchType;
28 1
    }
29
30
    /**
31
     * @param \CommerceGuys\AuthNet\DataTypes\Sorting $sorting
32
     * @return $this
33
     */
34 1
    public function setSorting(Sorting $sorting)
35
    {
36 1
        $this->sorting = $sorting;
37 1
        return $this;
38
    }
39
40
    /**
41
     * @param \CommerceGuys\AuthNet\DataTypes\Paging $paging
42
     * @return $this
43
     */
44 1
    public function setPaging(Paging $paging)
45
    {
46 1
        $this->paging = $paging;
47 1
        return $this;
48
    }
49
50 1
    protected function attachData(RequestInterface $request)
51
    {
52 1
        $request->addData('searchType', $this->searchType);
53 1
        if ($this->sorting) {
54 1
            $request->addDataType($this->sorting);
55 1
        }
56 1
        if ($this->paging) {
57 1
            $request->addDataType($this->paging);
58 1
        }
59 1
    }
60
}
61