Ejemplo n.º 1
0
 /**
  * @expectedException InvalidArgumentException
  */
 public function testFactoryThrowsExceptionOnMissingTypeSubfield()
 {
     $record = Record::factory(array('fields' => array(array('tag' => '002@', 'occurrence' => 0, 'subfields' => array()))));
 }
Ejemplo n.º 2
0
 /**
  * Return next record in input data or FALSE if no more records.
  *
  * This function uses the Record::factory() method to create a record and
  * applies a possible filter function to the input data.
  *
  * @see Reader::setFilter()
  * @see Record::factory()
  *
  * @throws RuntimeException Error creating a record instance via factory function
  * @return Record|false
  */
 public function read()
 {
     $record = $this->next();
     if (is_array($record)) {
         $record = $this->applyFilter($record);
         if (is_array($record)) {
             try {
                 return Record::factory($record);
             } catch (Exception $e) {
                 throw new RuntimeException("Error creating record instance in Record::factory()", -1, $e);
             }
         }
     }
     return false;
 }