Exemple #1
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];
 }
Exemple #2
0
 /**
  * @inheritdoc
  */
 public function parse($data)
 {
     $records = MarcCollection::fromString($data)->records;
     return $this->convertRecord($records);
 }
Exemple #3
0
 public function testEmptyCollection()
 {
     $source = '<?xml version="1.0" encoding="UTF-8" ?><test></test>';
     $collection = Collection::fromString($source);
     $this->assertCount(0, $collection->toArray());
 }