ARBGetSubscriptionListRequest   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 45
ccs 0
cts 17
cp 0
rs 10
wmc 6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setPaging() 0 4 1
A attachData() 0 8 3
A __construct() 0 7 1
A setSorting() 0 4 1
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