Conditions | 2 |
Paths | 2 |
Total Lines | 29 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php namespace Scriptotek\OaiPmh; |
||
26 | public function __construct($text, &$client = null) |
||
27 | { |
||
28 | $this->rawResponse = $text; |
||
29 | |||
30 | // Throws Danmichaelo\QuiteSimpleXMLElement\InvalidXMLException on invalid xml |
||
31 | $this->response = new QuiteSimpleXMLElement($text); |
||
32 | |||
33 | $this->client = $client; |
||
34 | |||
35 | $this->response->registerXPathNamespaces(array( |
||
36 | 'oai' => 'http://www.openarchives.org/OAI/2.0/', |
||
37 | )); |
||
38 | |||
39 | /* Possible error codes: |
||
40 | badArgument |
||
41 | badResumptionToken |
||
42 | badVerb |
||
43 | cannotDisseminateFormat |
||
44 | idDoesNotExist |
||
45 | noRecordsMatch |
||
46 | noMetaDataFormats |
||
47 | noSetHierarchy |
||
48 | http://www.openarchives.org/OAI/openarchivesprotocol.html#ErrorConditions |
||
49 | */ |
||
50 | $err = $this->response->first('/oai:OAI-PMH/oai:error'); |
||
51 | if ($err) { |
||
52 | throw new BadRequestError($err->attr('code') . ' : ' . $err->text()); |
||
53 | } |
||
54 | } |
||
55 | |||
66 |