Beispiel #1
0
 /**
  * @inheritdoc
  */
 public function open(Resource $resource)
 {
     $file = $resource->getMetadata('file');
     if (!is_file($file)) {
         throw new \InvalidArgumentException(sprintf('File "%s" not found.', $file));
     }
     try {
         $data = (array) Yaml::parse($file);
     } catch (\Exception $e) {
         throw new \InvalidArgumentException($e->getMessage(), 0, $e);
     }
     $this->inMemoryReader = new InMemoryReader();
     $this->inMemoryReader->open(new Resource(array('data' => $data), 'in_memory'));
 }
 /**
  * @covers Yosmanyga\Resource\Reader\Iterator\InMemoryReader::close
  * @expectedException \RuntimeException
  */
 public function testClose()
 {
     $reader = new InMemoryReader();
     $reader->open(new Resource(array('data' => array()), 'in_memory'));
     $reader->close();
     $reader->current();
 }