Example #1
0
 /**
  * Outputs internal model into buffer or a file
  *
  * @param string $path
  * 
  * @return mixed boolean|string
  * 
  * @throws Exception if an incorrect destination path is supplied
  */
 public function save($path = null)
 {
     if ($path == 'php://output') {
         print $this->build($this->tablature->getFormat());
         return true;
     } else {
         if (null === $path) {
             return $this->build($this->tablature->getFormat());
         } else {
             if (is_string($path)) {
                 $parts = pathinfo($path);
                 if (!isset($parts['basename'], $parts['extension'])) {
                     $message = sprintf('Destination path %s is not complete', $path);
                     throw new Exception($message);
                 }
                 $this->path = $path;
                 return $this->record($this->build($parts['extension']));
             }
         }
     }
     throw new Exception('Save path is not allowed');
 }
Example #2
0
 /**
  * @param Tablature The tablature to dump
  */
 public function __construct(Tablature $tablature)
 {
     $this->song = $tablature->getSong();
 }