Example #1
0
 /**
  * Set the base path
  * @param string|\SplFileInfo $basePath
  * @postcondition resets formatted path/class
  * @throws \InvalidArgumentException
  * @throws \Jazz\File\Exception\DoesNotExist
  */
 public function setBasePath($basePath = null)
 {
     $val = null;
     if (is_string($basePath)) {
         $val = \Jazz\File::appendPath($basePath);
     } else {
         if ($basePath instanceof \SplFileInfo && $basePath->isDir()) {
             $val = \Jazz\File::appendPath($basePath->getPathname());
         } else {
             if ($basePath !== null) {
                 throw new \InvalidArgumentException('path');
             }
         }
     }
     if ($val !== null && !file_exists($val)) {
         require_once 'Jazz/File/Exception/DoesNotExist.php';
         throw new \Jazz\File\Exception\DoesNotExist($val);
     }
     $this->_basePath = $val;
     $this->reset();
 }