Test Failed
Push — master ( 4695a7...74b52e )
by Bojan
03:28
created

ARBGetSubscriptionListRequest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 2
dl 0
loc 48
ccs 0
cts 19
cp 0
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
    public function __construct(
22
        Configuration $configuration,
23
        Client $client,
24
        $searchType
25
    ) {
26
        parent::__construct($configuration, $client);
27
        $this->searchType = $searchType;
28
    }
29
30
    /**
31
     * @param \CommerceGuys\AuthNet\DataTypes\Sorting $sorting
32
     * @return $this
33
     */
34
    public function setSorting(Sorting $sorting)
35
    {
36
        $this->sorting = $sorting;
37
        return $this;
38
    }
39
40
    /**
41
     * @param \CommerceGuys\AuthNet\DataTypes\Paging $paging
42
     * @return $this
43
     */
44
    public function setPaging(Paging $paging)
45
    {
46
        $this->paging = $paging;
47
        return $this;
48
    }
49
50
    protected function attachData(RequestInterface $request)
51
    {
52
        $request->addData('searchType', $this->searchType);
53
        if ($this->sorting) {
54
            $request->addDataType($this->sorting);
55
        }
56
        if ($this->paging) {
57
            $request->addDataType($this->paging);
58
        }
59
    }
60
}
61