1 | <?php namespace Scriptotek\Sru; |
||
8 | class Client |
||
9 | { |
||
10 | /** @var HttpClient */ |
||
11 | protected $httpClient; |
||
12 | |||
13 | /** @var string SRU service base URL */ |
||
14 | protected $url; |
||
15 | |||
16 | /** @var string Requested schema for the returned records */ |
||
17 | protected $schema; |
||
18 | |||
19 | /** @var string SRU protocol version */ |
||
20 | protected $version; |
||
21 | |||
22 | /** @var string Some user agent string to identify our client */ |
||
23 | protected $userAgent; |
||
24 | |||
25 | /** |
||
26 | * @var string|string[] Proxy configuration details. |
||
27 | * |
||
28 | * Either a string 'host:port' or an |
||
29 | * array('host:port', 'username', 'password'). |
||
30 | */ |
||
31 | protected $proxy; |
||
32 | |||
33 | /** |
||
34 | * @var string[] Array containing username and password |
||
35 | */ |
||
36 | protected $credentials; |
||
37 | |||
38 | /** |
||
39 | * Create a new client |
||
40 | * |
||
41 | * @param string $url Base URL to the SRU service |
||
42 | * @param array $options Associative array of options |
||
43 | * @param HttpClient $httpClient |
||
44 | */ |
||
45 | public function __construct($url, $options = null, $httpClient = null) |
||
71 | |||
72 | /** |
||
73 | * Construct the URL for a CQL query |
||
74 | * |
||
75 | * @param string $cql The CQL query |
||
76 | * @param int $start Start value in result set (optional) |
||
77 | * @param int $count Number of records to request (optional) |
||
78 | * @param array $extraParams Extra GET parameters |
||
79 | * @return string |
||
80 | */ |
||
81 | public function urlTo($cql, $start = 1, $count = 10, $extraParams = array()) |
||
103 | |||
104 | /** |
||
105 | * Get HTTP client configuration options (authentication, proxy, headers) |
||
106 | * |
||
107 | * @return array |
||
108 | */ |
||
109 | public function getHttpOptions() |
||
128 | |||
129 | /** |
||
130 | * Perform a searchRetrieve request |
||
131 | * |
||
132 | * @deprecated |
||
133 | * @param string $cql |
||
134 | * @param int $start Start value in result set (optional) |
||
135 | * @param int $count Number of records to request (optional) |
||
136 | * @param array $extraParams Extra GET parameters |
||
137 | * @return SearchRetrieveResponse |
||
138 | */ |
||
139 | public function search($cql, $start = 1, $count = 10, $extraParams = array()) |
||
149 | |||
150 | /** |
||
151 | * Perform a searchRetrieve request and return an iterator over the records |
||
152 | * |
||
153 | * @param string $cql |
||
154 | * @param int $batchSize Number of records to request per request |
||
155 | * @param array $extraParams Extra GET parameters |
||
156 | * @param mixed $httpClient A http client |
||
157 | * @return Records |
||
158 | */ |
||
159 | public function all($cql, $batchSize = 10, $extraParams = array(), $httpClient = null) |
||
163 | |||
164 | /** |
||
165 | * Alias for `all()` |
||
166 | * @deprecated |
||
167 | */ |
||
168 | public function records($cql, $batchSize = 10, $extraParams = array(), $httpClient = null) |
||
172 | |||
173 | /** |
||
174 | * Perform a searchRetrieve request and return first record |
||
175 | * |
||
176 | * @param string $cql |
||
177 | * @param array $extraParams Extra GET parameters |
||
178 | * @param mixed $httpClient A http client |
||
179 | * @return Record |
||
180 | */ |
||
181 | public function first($cql, $extraParams = array(), $httpClient = null) |
||
186 | |||
187 | /** |
||
188 | * Perform an explain request |
||
189 | * |
||
190 | * @return ExplainResponse |
||
191 | */ |
||
192 | public function explain() |
||
205 | } |
||
206 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.