Passed
Pull Request — master (#1)
by Silvan
06:17
created

NovaApiClient::searchServices()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace OrcaServices\NovaApi\Client;
4
5
use OrcaServices\NovaApi\Method\CheckSwissPassValidityMethod;
6
use OrcaServices\NovaApi\Method\NovaConfirmReceiptsMethod;
7
use OrcaServices\NovaApi\Method\NovaCreateOffersMethod;
8
use OrcaServices\NovaApi\Method\NovaCreateReceiptsMethod;
9
use OrcaServices\NovaApi\Method\NovaCreateServicesMethod;
10
use OrcaServices\NovaApi\Method\NovaPurchaseServicesMethod;
11
use OrcaServices\NovaApi\Method\NovaSearchPartnerMethod;
12
use OrcaServices\NovaApi\Method\NovaSearchServicesMethod;
13
use OrcaServices\NovaApi\Parameter\NovaCheckSwissPassValidityParameter;
14
use OrcaServices\NovaApi\Parameter\NovaConfirmReceiptsParameter;
15
use OrcaServices\NovaApi\Parameter\NovaCreateOffersParameter;
16
use OrcaServices\NovaApi\Parameter\NovaCreateReceiptsParameter;
17
use OrcaServices\NovaApi\Parameter\NovaCreateServicesParameter;
18
use OrcaServices\NovaApi\Parameter\NovaPurchaseServicesParameter;
19
use OrcaServices\NovaApi\Parameter\NovaSearchPartnerParameter;
20
use OrcaServices\NovaApi\Parameter\NovaSearchServicesParameter;
21
use OrcaServices\NovaApi\Result\NovaCheckSwissPassValidityResult;
22
use OrcaServices\NovaApi\Result\NovaConfirmReceiptsResult;
23
use OrcaServices\NovaApi\Result\NovaCreateOffersResult;
24
use OrcaServices\NovaApi\Result\NovaCreateReceiptsResult;
25
use OrcaServices\NovaApi\Result\NovaCreateServicesResult;
26
use OrcaServices\NovaApi\Result\NovaPurchaseServicesResult;
27
use OrcaServices\NovaApi\Result\NovaSearchPartnerResult;
28
use OrcaServices\NovaApi\Result\NovaSearchServicesResult;
29
30
/**
31
 * NOVA API client.
32
 */
33
final class NovaApiClient
34
{
35
    /**
36
     * @var NovaSearchServicesMethod
37
     */
38
    protected $novaSearchServicesMethod;
39
40
    /**
41
     * @var NovaSearchPartnerMethod
42
     */
43
    private $novaSearchPartnerMethod;
44
45
    /**
46
     * @var CheckSwissPassValidityMethod
47
     */
48
    private $checkSwissPassValidityMethod;
49
50
    /**
51
     * @var NovaCreateOffersMethod
52
     */
53
    private $novaCreateOffersMethod;
54
55
    /**
56
     * @var NovaCreateServicesMethod
57
     */
58
    private $novaCreateServicesMethod;
59
60
    /**
61
     * @var NovaPurchaseServicesMethod
62
     */
63
    private $novaPurchaseServicesMethod;
64
65
    /**
66
     * @var NovaCreateReceiptsMethod
67
     */
68
    private $novaCreateReceiptsMethod;
69
70
    /**
71
     * @var NovaConfirmReceiptsMethod
72
     */
73
    private $novaConfirmReceiptsMethod;
74
75
    /**
76
     * NovaApiClient constructor.
77
     *
78
     * @param NovaSearchPartnerMethod $novaSearchPartnerMethod The method
79
     * @param CheckSwissPassValidityMethod $checkSwissPassValidityMethod The method
80
     * @param NovaCreateOffersMethod $novaCreateOffersMethod The method
81
     * @param NovaCreateServicesMethod $novaCreateServicesMethod The method
82
     * @param NovaPurchaseServicesMethod $novaPurchaseServicesMethod The method
83
     * @param NovaCreateReceiptsMethod $novaCreateReceiptsMethod The method
84
     * @param NovaConfirmReceiptsMethod $novaConfirmReceiptsMethod The method
85
     * @param NovaSearchServicesMethod $novaSearchServicesMethod The method
86
     */
87 10
    public function __construct(
88
        NovaSearchPartnerMethod $novaSearchPartnerMethod,
89
        CheckSwissPassValidityMethod $checkSwissPassValidityMethod,
90
        NovaCreateOffersMethod $novaCreateOffersMethod,
91
        NovaCreateServicesMethod $novaCreateServicesMethod,
92
        NovaPurchaseServicesMethod $novaPurchaseServicesMethod,
93
        NovaCreateReceiptsMethod $novaCreateReceiptsMethod,
94
        NovaConfirmReceiptsMethod $novaConfirmReceiptsMethod,
95
        NovaSearchServicesMethod $novaSearchServicesMethod
96
    ) {
97 10
        $this->novaSearchPartnerMethod = $novaSearchPartnerMethod;
98 10
        $this->checkSwissPassValidityMethod = $checkSwissPassValidityMethod;
99 10
        $this->novaCreateOffersMethod = $novaCreateOffersMethod;
100 10
        $this->novaCreateServicesMethod = $novaCreateServicesMethod;
101 10
        $this->novaPurchaseServicesMethod = $novaPurchaseServicesMethod;
102 10
        $this->novaCreateReceiptsMethod = $novaCreateReceiptsMethod;
103 10
        $this->novaConfirmReceiptsMethod = $novaConfirmReceiptsMethod;
104 10
        $this->novaSearchServicesMethod = $novaSearchServicesMethod;
105 10
    }
106
107
    /**
108
     * Search partner (customers).
109
     *
110
     * @param NovaSearchPartnerParameter $parameter The search parameters
111
     *
112
     * @return NovaSearchPartnerResult The search result
113
     */
114 2
    public function searchPartner(NovaSearchPartnerParameter $parameter): NovaSearchPartnerResult
115
    {
116 2
        return $this->novaSearchPartnerMethod->searchPartner($parameter);
117
    }
118
119
    /**
120
     * Check SwissPass validity.
121
     *
122
     * @param NovaCheckSwissPassValidityParameter $parameter The parameters
123
     *
124
     * @return NovaCheckSwissPassValidityResult The result
125
     */
126 2
    public function checkSwissPassValidity(
127
        NovaCheckSwissPassValidityParameter $parameter
128
    ): NovaCheckSwissPassValidityResult {
129 2
        return $this->checkSwissPassValidityMethod->checkSwissPassValidity($parameter);
130
    }
131
132
    /**
133
     * Create offers.
134
     *
135
     * @param NovaCreateOffersParameter $parameter The offers parameters
136
     *
137
     * @return NovaCreateOffersResult The result
138
     */
139 1
    public function createOffers(NovaCreateOffersParameter $parameter): NovaCreateOffersResult
140
    {
141 1
        return $this->novaCreateOffersMethod->createOffers($parameter);
142
    }
143
144
    /**
145
     * Create service.
146
     *
147
     * @param NovaCreateServicesParameter $parameter The service parameters
148
     *
149
     * @return NovaCreateServicesResult The result
150
     */
151 1
    public function createService(NovaCreateServicesParameter $parameter): NovaCreateServicesResult
152
    {
153 1
        return $this->novaCreateServicesMethod->createService($parameter);
154
    }
155
156
    /**
157
     * Purchase service.
158
     *
159
     * @param NovaPurchaseServicesParameter $parameter The parameters
160
     *
161
     * @return NovaPurchaseServicesResult The result
162
     */
163 1
    public function purchaseService(NovaPurchaseServicesParameter $parameter): NovaPurchaseServicesResult
164
    {
165 1
        return $this->novaPurchaseServicesMethod->purchaseService($parameter);
166
    }
167
168
    /**
169
     * Create receipt.
170
     *
171
     * @param NovaCreateReceiptsParameter $parameter The parameters
172
     *
173
     * @return NovaCreateReceiptsResult The result
174
     */
175 1
    public function createReceipt(NovaCreateReceiptsParameter $parameter): NovaCreateReceiptsResult
176
    {
177 1
        return $this->novaCreateReceiptsMethod->createReceipts($parameter);
178
    }
179
180
    /**
181
     * Confirm receipt.
182
     *
183
     * @param NovaConfirmReceiptsParameter $parameter The parameters
184
     *
185
     * @return NovaConfirmReceiptsResult The result
186
     */
187 1
    public function confirmReceipt(NovaConfirmReceiptsParameter $parameter): NovaConfirmReceiptsResult
188
    {
189 1
        return $this->novaConfirmReceiptsMethod->confirmReceipts($parameter);
190
    }
191
192
    /**
193
     * Search partner (customers).
194
     *
195
     * @param NovaSearchPartnerParameter $parameter The search parameters
196
     *
197
     * @return NovaSearchPartnerResult The search result
198
     */
199 1
    public function searchServices(NovaSearchServicesParameter $parameter): NovaSearchServicesResult
200
    {
201 1
        return $this->novaSearchServicesMethod->searchServices($parameter);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->novaSearch...rchServices($parameter) returns the type OrcaServices\NovaApi\Res...ovaSearchServicesResult which is incompatible with the documented return type OrcaServices\NovaApi\Res...NovaSearchPartnerResult.
Loading history...
202
    }
203
}
204