1 | <?php |
||
15 | class ViafFilteredHttpResponseParser extends FilteredHttpResponseParser { |
||
16 | |||
17 | /** |
||
18 | * @see http://crosscite.org/cn/ |
||
19 | */ |
||
20 | const VIAF_REST = "http://viaf.org/viaf/"; |
||
21 | |||
22 | /** |
||
23 | * @since 0.1 |
||
24 | * |
||
25 | * {@inheritDoc} |
||
26 | */ |
||
27 | 4 | public function getRawResponseById( $viafID ) { |
|
28 | 4 | return $this->requestResponseFor( $viafID ); |
|
29 | } |
||
30 | |||
31 | /** |
||
32 | * @since 0.1 |
||
33 | * |
||
34 | * {@inheritDoc} |
||
35 | */ |
||
36 | 6 | public function doFilterResponseById( $viafID ) { |
|
37 | |||
38 | 6 | $xml = $this->requestResponseFor( $viafID ); |
|
39 | |||
40 | 6 | if ( $this->httpRequest->getLastError() !== '' ) { |
|
41 | 1 | return $this->addMessage( array( 'onoi-remi-request-error', $this->httpRequest->getLastError(), $viafID ) ); |
|
42 | } |
||
43 | |||
44 | 5 | if ( $xml === null || $xml === '' || $xml === false ) { |
|
45 | 1 | return $this->addMessage( array( 'onoi-remi-response-empty', $viafID ) ); |
|
46 | } |
||
47 | |||
48 | 4 | $dom = new DOMDocument(); |
|
49 | 4 | $dom->loadXml( $xml ); |
|
50 | |||
51 | 4 | $this->doProcessDom( $dom, $viafID ); |
|
52 | |||
53 | 4 | $this->filteredRecord->set( 'retrieved-from', 'http://viaf.org/' ); |
|
54 | 4 | } |
|
55 | |||
56 | 4 | private function doProcessDom( $dom, $viafID ) { |
|
93 | |||
94 | /** |
||
95 | * @param string $id |
||
96 | * |
||
97 | * @return string |
||
98 | */ |
||
99 | 6 | private function requestResponseFor( $id ) { |
|
114 | |||
115 | } |
||
116 |