GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#127)
by
unknown
07:11
created

Search::getPage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/*
3
 * Copyright 2016 Jan Eichhorn <[email protected]>
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
8
 *
9
 * http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
namespace ApaiIO\Operations;
19
20
/**
21
 * A item search operation
22
 *
23
 * @see    http://docs.aws.amazon.com/AWSECommerceService/2011-08-01/DG/ItemSearch.html
24
 * @author Jan Eichhorn <[email protected]>
25
 *
26
 * @method Search setMerchantId(string $merchantId)
27
 */
28
class Search extends AbstractOperation
29
{
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function getName()
34
    {
35
        return 'ItemSearch';
36
    }
37
38
    /**
39
     * Return the amazon category
40
     *
41
     * @return string
42
     */
43
    public function getCategory()
44
    {
45
        return $this->getSingleOperationParameter('SearchIndex');
46
    }
47
48
    /**
49
     * Sets the amazon category
50
     *
51
     * @param string $category
52
     *
53
     * @return \ApaiIO\Operations\Search
54
     */
55
    public function setCategory($category)
56
    {
57
        $this->parameters['SearchIndex'] = $category;
58
59
        return $this;
60
    }
61
62
    /**
63
     * Returns the keywords
64
     *
65
     * @return string
66
     */
67
    public function getKeywords()
68
    {
69
        return $this->getSingleOperationParameter('Keywords');
70
    }
71
72
    /**
73
     * Sets the keywords
74
     *
75
     * @param string $keywords
76
     *
77
     * @return \ApaiIO\Operations\Search
78
     */
79
    public function setKeywords($keywords)
80
    {
81
        $this->parameters['Keywords'] = $keywords;
82
83
        return $this;
84
    }
85
86
    
87
    
88
      /**
89
     * Returns the keywords
90
     *
91
     * @return string
92
     */
93
    public function getIdType()
94
    {
95
        return $this->getSingleOperationParameter('idType');
96
    }
97
98
    /**
99
     * Sets the keywords
100
     *
101
     * @param string $keywords
0 ignored issues
show
Bug introduced by
There is no parameter named $keywords. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
102
     *
103
     * @return \ApaiIO\Operations\Search
104
     */
105
    public function setIdType($idType)
106
    {
107
        $this->parameters['idType'] = $idType;
108
109
        return $this;
110
    }
111
    
112
    
113
    
114
    
115
    
116
    
117
    /**
118
     * Return the resultpage
119
     *
120
     * @return integer
121
     */
122
    public function getPage()
123
    {
124
        return $this->getSingleOperationParameter('ItemPage');
125
    }
126
127
    /**
128
     * Sets the resultpage to a specified value
129
     * Allows to browse resultsets which have more than one page
130
     *
131
     * @param integer $page
132
     *
133
     * @return \ApaiIO\Operations\Search
134
     */
135
    public function setPage($page)
136
    {
137
        if (false === is_numeric($page) || $page < 1 || $page > 10) {
138
            throw new \InvalidArgumentException(sprintf('%s is an invalid page value. It has to be numeric, positive and between 1 and 10',
139
                    $page));
140
        }
141
142
        $this->parameters['ItemPage'] = $page;
143
144
        return $this;
145
    }
146
147
    /**
148
     * Return the minimum price as integer so 8.99$ will be returned as 899
149
     *
150
     * @return integer
151
     */
152
    public function getMinimumPrice()
153
    {
154
        return $this->getSingleOperationParameter('MinimumPrice');
155
    }
156
157
    /**
158
     * Sets the minimum price to a specified value for the search
159
     * Currency will be given by the site you are querying: EUR for IT, USD for COM
160
     * Price should be given as integer. 8.99$ USD becomes 899
161
     *
162
     * @param integer $price
163
     *
164
     * @return \ApaiIO\Operations\Search
165
     */
166
    public function setMinimumPrice($price)
167
    {
168
        $this->validatePrice($price);
169
        $this->parameters['MinimumPrice'] = $price;
170
171
        return $this;
172
    }
173
174
    /**
175
     * Returns the maximum price as integer so 8.99$ will be returned as 899
176
     * @return mixed
177
     */
178
    public function getMaximumPrice()
179
    {
180
        return $this->getSingleOperationParameter('MaximumPrice');
181
    }
182
183
    /**
184
     * Sets the maximum price to a specified value for the search
185
     * Currency will be given by the site you are querying: EUR for IT, USD for COM
186
     * Price should be given as integer. 8.99$ USD becomes 899
187
     *
188
     * @param integer $price
189
     *
190
     * @return \ApaiIO\Operations\Search
191
     */
192
    public function setMaximumPrice($price)
193
    {
194
        $this->validatePrice($price);
195
        $this->parameters['MaximumPrice'] = $price;
196
197
        return $this;
198
    }
199
200
    /**
201
     * Returns the condition of the items to return. New | Used | Collectible | Refurbished | All
202
     *
203
     * @return string
204
     */
205
    public function getCondition()
206
    {
207
        return $this->getSingleOperationParameter('Condition');
208
    }
209
210
    /**
211
     * Sets the condition of the items to return: New | Used | Collectible | Refurbished | All
212
     *
213
     * Defaults to New.
214
     *
215
     * @param string $condition
216
     *
217
     * @return \ApaiIO\Operations\Search
218
     */
219
    public function setCondition($condition)
220
    {
221
        $this->parameters['Condition'] = $condition;
222
223
        return $this;
224
    }
225
226
    /**
227
     * Returns the availability.
228
     *
229
     * @return string
230
     */
231
    public function getAvailability()
232
    {
233
        return $this->getSingleOperationParameter('Availability');
234
    }
235
236
    /**
237
     * Sets the availability. Don't use method if you want the default Amazon behaviour.
238
     * Only valid value = Available
239
     *
240
     * @param string $availability
241
     * @see http://docs.aws.amazon.com/AWSECommerceService/latest/DG/CHAP_ReturningPriceAndAvailabilityInformation-itemsearch.html
242
     *
243
     * @return \ApaiIO\Operations\Search
244
     */
245
    public function setAvailability($availability)
246
    {
247
        $this->parameters['Availability'] = $availability;
248
249
        return $this;
250
    }
251
252
    /**
253
     * Returns the browseNodeId
254
     *
255
     * @return integer
256
     */
257
    public function getBrowseNode()
258
    {
259
        return $this->getSingleOperationParameter('BrowseNode');
260
    }
261
262
    /**
263
     * Sets the browseNodeId
264
     *
265
     * @param integer $browseNodeId
266
     *
267
     * @return \ApaiIO\Operations\Search
268
     */
269
    public function setBrowseNode($browseNodeId)
270
    {
271
        $this->parameters['BrowseNode'] = $browseNodeId;
272
273
        return $this;
274
    }
275
276
    /**
277
     * Validates the given price.
278
     *
279
     * @param integer $price
280
     */
281
    protected function validatePrice($price)
282
    {
283
        if (false === is_numeric($price) || $price < 1) {
284
            throw new \InvalidArgumentException(sprintf('%s is an invalid price value. It has to be numeric and >= than 1',
285
                    $price));
286
        }
287
    }
288
}
289