1 | <?php |
||
34 | class Client implements ClientInterface |
||
35 | { |
||
36 | /** |
||
37 | * @var string |
||
38 | */ |
||
39 | private $url; |
||
40 | |||
41 | /** |
||
42 | * @var HttpAdapterInterface |
||
43 | */ |
||
44 | private $httpClient; |
||
45 | |||
46 | /** |
||
47 | * Constructor |
||
48 | * |
||
49 | * @param string $url The URL of the OAI-PMH Endpoint |
||
50 | * @param HttpAdapterInterface $httpClient Optional HTTP HttpAdapterInterface class; attempt to |
||
51 | * auto-build dependency if not passed |
||
52 | * @throws \Exception |
||
53 | */ |
||
54 | public function __construct($url = null, HttpAdapterInterface $httpClient = null) |
||
66 | |||
67 | /** |
||
68 | * Perform a request and return a OAI SimpleXML Document |
||
69 | * |
||
70 | * @param string $verb Which OAI-PMH verb to use |
||
71 | * @param array $params An array of key/value parameters |
||
72 | * @return \SimpleXMLElement An XML document |
||
73 | */ |
||
74 | public function request($verb, array $params = array()) |
||
94 | |||
95 | /** |
||
96 | * Check for OAI-PMH Exception from HTTP Exception |
||
97 | * |
||
98 | * Converts a HttpException into an OAI-PMH exception if there is an |
||
99 | * OAI-PMH Error Code. |
||
100 | * |
||
101 | * @param HttpException $httpException |
||
102 | */ |
||
103 | private function checkForOaipmhException(HttpException $httpException) |
||
115 | |||
116 | /** |
||
117 | * Decode the response into XML |
||
118 | * |
||
119 | * @param string $resp The response body from a HTTP request |
||
120 | * @return \SimpleXMLElement An XML document |
||
121 | */ |
||
122 | protected function decodeResponse($resp) |
||
141 | } |
||
142 |