1 | <?php namespace Scriptotek\Sru; |
||
15 | class Client |
||
16 | { |
||
17 | /** @var ClientInterface */ |
||
18 | protected $httpClient; |
||
19 | |||
20 | /** |
||
21 | * @var RequestFactoryInterface |
||
22 | */ |
||
23 | private $requestFactory; |
||
24 | |||
25 | /** @var string SRU service base URL */ |
||
26 | protected $url; |
||
27 | |||
28 | /** @var string Requested schema for the returned records */ |
||
29 | protected $schema; |
||
30 | |||
31 | /** @var string SRU protocol version */ |
||
32 | protected $version; |
||
33 | |||
34 | /** @var string Some user agent string to identify our client */ |
||
35 | protected $userAgent; |
||
36 | |||
37 | /** @var array Custom headers */ |
||
38 | public $headers; |
||
39 | |||
40 | /** |
||
41 | * @var string|string[] Proxy configuration details. |
||
42 | * |
||
43 | * Either a string 'host:port' or an |
||
44 | * array('host:port', 'username', 'password'). |
||
45 | */ |
||
46 | protected $proxy; |
||
47 | |||
48 | /** |
||
49 | * @var string[] Array containing username and password |
||
50 | */ |
||
51 | protected $credentials; |
||
52 | |||
53 | /** |
||
54 | * Create a new client |
||
55 | * |
||
56 | * @param string $url Base URL to the SRU service |
||
57 | * @param array $options Associative array of options |
||
58 | * @param ClientInterface $httpClient |
||
59 | * @param RequestFactoryInterface $requestFactory |
||
60 | * @throws \ErrorException |
||
61 | */ |
||
62 | public function __construct( |
||
102 | |||
103 | /** |
||
104 | * Construct the URL for a CQL query |
||
105 | * |
||
106 | * @param string $cql The CQL query |
||
107 | * @param int $start Start value in result set (optional) |
||
108 | * @param int $count Number of records to request (optional) |
||
109 | * @param array $extraParams Extra GET parameters |
||
110 | * @return string |
||
111 | */ |
||
112 | public function urlTo($cql, $start = 1, $count = 10, $extraParams = array()) |
||
134 | |||
135 | /** |
||
136 | * Perform a searchRetrieve request |
||
137 | * |
||
138 | * @deprecated |
||
139 | * @param string $cql |
||
140 | * @param int $start Start value in result set (optional) |
||
141 | * @param int $count Number of records to request (optional) |
||
142 | * @param array $extraParams Extra GET parameters |
||
143 | * @return SearchRetrieveResponse |
||
144 | */ |
||
145 | public function search($cql, $start = 1, $count = 10, $extraParams = array()) |
||
152 | |||
153 | /** |
||
154 | * Perform a searchRetrieve request and return an iterator over the records |
||
155 | * |
||
156 | * @param string $cql |
||
157 | * @param int $batchSize Number of records to request per request |
||
158 | * @param array $extraParams Extra GET parameters |
||
159 | * @return Records |
||
160 | */ |
||
161 | public function all($cql, $batchSize = 10, $extraParams = array()) |
||
165 | |||
166 | /** |
||
167 | * Alias for `all()` |
||
168 | * @deprecated |
||
169 | * @param $cql |
||
170 | * @param int $batchSize |
||
171 | * @param array $extraParams |
||
172 | * @return Records |
||
173 | */ |
||
174 | public function records($cql, $batchSize = 10, $extraParams = array()) |
||
178 | |||
179 | /** |
||
180 | * Perform a searchRetrieve request and return first record |
||
181 | * |
||
182 | * @param string $cql |
||
183 | * @param array $extraParams Extra GET parameters |
||
184 | * @return Record |
||
185 | */ |
||
186 | public function first($cql, $extraParams = array()) |
||
191 | |||
192 | /** |
||
193 | * Perform an explain request |
||
194 | * |
||
195 | * @return ExplainResponse |
||
196 | */ |
||
197 | public function explain() |
||
208 | |||
209 | /** |
||
210 | * @param string $method |
||
211 | * @param string $url |
||
212 | * @return string |
||
213 | */ |
||
214 | public function request($method, $url) |
||
225 | } |
||
226 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.