1 | <?php |
||
34 | class Client implements ClientInterface |
||
35 | { |
||
36 | /** |
||
37 | * @var string |
||
38 | */ |
||
39 | private $url; |
||
40 | |||
41 | /** |
||
42 | * @var HttpAdapterInterface |
||
43 | */ |
||
44 | private $httpAdapter; |
||
45 | |||
46 | /** |
||
47 | * Constructor |
||
48 | * |
||
49 | * @param string $url The URL of the OAI-PMH Endpoint |
||
50 | * @param HttpAdapterInterface $httpAdapter Optional HTTP HttpAdapterInterface class; attempt to |
||
51 | * auto-build dependency if not passed |
||
52 | * @throws \Exception |
||
53 | */ |
||
54 | public function __construct($url = null, HttpAdapterInterface $httpAdapter = null) |
||
66 | |||
67 | /** |
||
68 | * @return HttpAdapterInterface |
||
69 | */ |
||
70 | public function getHttpAdapter() |
||
74 | |||
75 | /** |
||
76 | * Perform a request and return a OAI SimpleXML Document |
||
77 | * |
||
78 | * @param string $verb Which OAI-PMH verb to use |
||
79 | * @param array $params An array of key/value parameters |
||
80 | * @return \SimpleXMLElement An XML document |
||
81 | */ |
||
82 | public function request($verb, array $params = array()) |
||
102 | |||
103 | /** |
||
104 | * Check for OAI-PMH Exception from HTTP Exception |
||
105 | * |
||
106 | * Converts a HttpException into an OAI-PMH exception if there is an |
||
107 | * OAI-PMH Error Code. |
||
108 | * |
||
109 | * @param HttpException $httpException |
||
110 | */ |
||
111 | private function checkForOaipmhException(HttpException $httpException) |
||
123 | |||
124 | /** |
||
125 | * Decode the response into XML |
||
126 | * |
||
127 | * @param string $resp The response body from a HTTP request |
||
128 | * @return \SimpleXMLElement An XML document |
||
129 | */ |
||
130 | protected function decodeResponse($resp) |
||
149 | } |
||
150 |