示例#1
0
 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;
     }
 }
示例#2
0
 /**
  * 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];
 }
示例#3
0
 protected function getNthrecord($n)
 {
     $records = Collection::fromFile('tests/data/sru-alma.xml')->toArray();
     return $records[$n - 1];
 }
示例#4
0
 /**
  * @inheritdoc
  */
 public function loadFile($file)
 {
     $collection = MarcCollection::fromFile($file);
     return $this->convertRecord($collection->records);
 }
示例#5
0
 public function testAlmaSample()
 {
     $collection = Collection::fromFile('tests/data/sru-alma.xml');
     $this->assertCount(3, $collection->toArray());
 }