Example #1
0
 /**
  * Instanciates tablature container
  * Try to load the right dedicated reader
  * 
  * @param File $file file which should contain a tablature
  * 
  * @throws Exception If file format is not supported
  */
 public function __construct(File $file = null)
 {
     $this->tablature = new Tablature();
     if ($file->hasError()) {
         return;
     }
     if (isset($this->extensions[$file->getExtension()])) {
         $name = $this->extensions[$file->getExtension()];
         $this->tablature->setFormat($file->getExtension());
         $this->bridge = new $name($file);
     }
     // Bridge not found
     if (!$this->bridge instanceof ReaderInterface) {
         $message = sprintf('No reader has been found for "%s" type of file', $file->getExtension());
         $this->tablature->setError($message);
         throw new Exception($message);
     }
 }
Example #2
0
 /**
  * Closes the File read
  * 
  */
 protected function closeStream()
 {
     $this->file->closeStream();
 }
Example #3
0
 /**
  * Pointer exception
  * @expectedException Exception
  */
 public function testPointerException()
 {
     $file = new File($this->filename);
     $file->getStream(1);
     $file->getStream(50000000);
 }