| Conditions | 6 |
| Paths | 11 |
| Total Lines | 30 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php namespace Scriptotek\OaiPmh; |
||
| 27 | public function __construct($text, &$client = null) |
||
| 28 | { |
||
| 29 | parent::__construct($text, $client); |
||
| 30 | |||
| 31 | $this->records = array(); |
||
| 32 | |||
| 33 | $records = $this->response->first('/oai:OAI-PMH/oai:ListRecords'); |
||
| 34 | if (!$records) { |
||
| 35 | return; |
||
| 36 | } |
||
| 37 | |||
| 38 | foreach ($records->xpath('oai:record') as $record) { |
||
| 39 | $this->records[] = new Record($record); |
||
| 40 | } |
||
| 41 | |||
| 42 | $resumptionToken = $records->first('oai:resumptionToken'); |
||
| 43 | if (!$resumptionToken) { |
||
| 44 | return; |
||
| 45 | } |
||
| 46 | |||
| 47 | $this->resumptionToken = $resumptionToken->text(); |
||
| 48 | |||
| 49 | // These are optional: |
||
| 50 | if ($resumptionToken->attr('completeListSize') !== '') { |
||
| 51 | $this->numberOfRecords = intval($resumptionToken->attr('completeListSize')); |
||
| 52 | } |
||
| 53 | if ($resumptionToken->attr('cursor') !== '') { |
||
| 54 | $this->cursor = intval($resumptionToken->attr('cursor')); |
||
| 55 | } |
||
| 56 | } |
||
| 57 | } |
||
| 58 |