public function getCollection() { $isXml = substr($this->data, 0, 1) == '<'; if ($isXml) { $importer = new XmlImporter($this->data); return $importer->getCollection(); } else { $c = new Collection(); $c->parse($this->data, false); return $c; } }
/** * Returns the first record found in the string $data, or null if no records found. * * @param $data * @return null|Collection */ public static function fromString($data) { $records = Collection::fromString($data)->toArray(); if (!count($records)) { throw new RecordNotFound(); } return $records[0]; }
protected function getNthrecord($n) { $records = Collection::fromFile('tests/data/sru-alma.xml')->toArray(); return $records[$n - 1]; }
/** * @inheritdoc */ public function loadFile($file) { $collection = MarcCollection::fromFile($file); return $this->convertRecord($collection->records); }
public function testAlmaSample() { $collection = Collection::fromFile('tests/data/sru-alma.xml'); $this->assertCount(3, $collection->toArray()); }