1 | <?php |
||
26 | class Endpoint implements EndpointInterface |
||
27 | { |
||
28 | const AUTO = null; |
||
29 | |||
30 | /** |
||
31 | * @var Client |
||
32 | */ |
||
33 | private $client; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | */ |
||
38 | private $granularity; |
||
39 | |||
40 | /** |
||
41 | * Build endpoint using URL and default settings |
||
42 | * |
||
43 | * @param string $url |
||
44 | * @return Endpoint |
||
45 | */ |
||
46 | public static function build($url) |
||
50 | |||
51 | /** |
||
52 | * Constructor |
||
53 | * |
||
54 | * @param ClientInterface $client Optional; will attempt to auto-build dependency if not passed |
||
55 | * @param string $granularity Optional; the OAI date format for fetching records, use constants from |
||
56 | * Granularity class |
||
57 | */ |
||
58 | public function __construct(ClientInterface $client = null, $granularity = self::AUTO) |
||
63 | |||
64 | /** |
||
65 | * Identify the OAI-PMH Endpoint |
||
66 | * |
||
67 | * @return \SimpleXMLElement A XML document with attributes describing the repository |
||
68 | */ |
||
69 | public function identify() |
||
75 | |||
76 | /** |
||
77 | * List Metadata Formats |
||
78 | * |
||
79 | * Return the list of supported metadata format for a particular record (if $identifier |
||
80 | * is provided), or the entire repository (if no arguments are provided) |
||
81 | * |
||
82 | * @param string $identifier If specified, will return only those metadata formats that a particular record supports |
||
83 | * @return RecordIteratorInterface |
||
84 | */ |
||
85 | public function listMetadataFormats($identifier = null) |
||
91 | |||
92 | /** |
||
93 | * List Record Sets |
||
94 | * |
||
95 | * @return RecordIteratorInterface |
||
96 | */ |
||
97 | public function listSets() |
||
101 | |||
102 | /** |
||
103 | * Get a single record |
||
104 | * |
||
105 | * @param string $id Record Identifier |
||
106 | * @param string $metadataPrefix Required by OAI-PMH endpoint |
||
107 | * @return \SimpleXMLElement An XML document corresponding to the record |
||
108 | */ |
||
109 | public function getRecord($id, $metadataPrefix) |
||
118 | |||
119 | /** |
||
120 | * List Record identifiers |
||
121 | * |
||
122 | * Corresponds to OAI Verb to list record identifiers |
||
123 | * |
||
124 | * @param string $metadataPrefix Required by OAI-PMH endpoint |
||
125 | * @param \DateTimeInterface $from An optional 'from' date for selective harvesting |
||
126 | * @param \DateTimeInterface $until An optional 'until' date for selective harvesting |
||
127 | * @param string $set An optional setSpec for selective harvesting |
||
128 | * @param string $resumptionToken An optional resumptionToken for selective harvesting |
||
129 | * @return RecordIteratorInterface |
||
130 | */ |
||
131 | public function listIdentifiers($metadataPrefix, $from = null, $until = null, $set = null, $resumptionToken = null) |
||
135 | |||
136 | /** |
||
137 | * List Records |
||
138 | * |
||
139 | * Corresponds to OAI Verb to list records |
||
140 | * |
||
141 | * @param string $metadataPrefix Required by OAI-PMH endpoint |
||
142 | * @param \DateTimeInterface $from An optional 'from' date for selective harvesting |
||
143 | * @param \DateTimeInterface $until An optional 'from' date for selective harvesting |
||
144 | * @param string $set An optional setSpec for selective harvesting |
||
145 | * @param string $resumptionToken An optional resumptionToken for selective harvesting |
||
146 | * @return RecordIteratorInterface |
||
147 | */ |
||
148 | public function listRecords($metadataPrefix, $from = null, $until = null, $set = null, $resumptionToken = null) |
||
152 | |||
153 | /** |
||
154 | * Create a record iterator |
||
155 | * |
||
156 | * @param string $verb OAI Verb |
||
157 | * @param string $metadataPrefix Required by OAI-PMH endpoint |
||
158 | * @param \DateTimeInterface $from An optional 'from' date for selective harvesting |
||
159 | * @param \DateTimeInterface $until An optional 'from' date for selective harvesting |
||
160 | * @param string $set An optional setSpec for selective harvesting |
||
161 | * @param string $resumptionToken An optional resumptionToken for selective harvesting |
||
162 | * |
||
163 | * @return RecordIteratorInterface |
||
164 | */ |
||
165 | private function createRecordIterator($verb, $metadataPrefix, $from, $until, $set = null, $resumptionToken = null) |
||
195 | |||
196 | /** |
||
197 | * Lazy load granularity from Identify, if not specified |
||
198 | * |
||
199 | * @return string |
||
200 | */ |
||
201 | private function getGranularity() |
||
209 | |||
210 | /** |
||
211 | * Attempt to fetch date format from Identify endpoint (or use default) |
||
212 | * |
||
213 | * @return string |
||
214 | */ |
||
215 | private function fetchGranularity() |
||
223 | } |
||
224 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.