예제 #1
0
 /**
  * Check Options Integrity
  *
  * @throws Next\Tools\ClassMapper\ClassMapperException
  *   Output directory is not set
  *
  * @throws Next\Tools\ClassMapper\ClassMapperException
  *   Output directory doesn't exist or it's not a valid directory
  *
  * @throws Next\Tools\ClassMapper\ClassMapperException
  *   Output directory is not writable
  *
  * @throws Next\Tools\ClassMapper\ClassMapperException
  *   Filename is missing
  */
 protected function checkIntegrity()
 {
     // If we want to save the File...
     if ($this->options->save !== FALSE) {
         // ... an Output Directory must be set...
         if (empty($this->options->outputDirectory)) {
             throw ClassMapperException::noOutputDirectory();
         }
         // ... must exist
         if (!is_dir($this->options->outputDirectory)) {
             throw ClassMapperException::invalidOutputDirectory($this->options->outputDirectory);
         }
         // ... and must be writable
         if (!is_writable($this->options->outputDirectory)) {
             throw ClassMapperException::unwritableOutputDirectory($this->options->outputDirectory);
         }
         // ... and a filename must be set too
         if (empty($this->options->filename)) {
             throw ClassMapperException::missingOutputFilename();
         }
     }
 }
예제 #2
0
파일: XML.php 프로젝트: nextframework/next
 /**
  * Checks Options Integrity
  *
  * @throws Next\Tools\ClassMapper\ClassMapperException
  *   Output directory is not set
  *
  * @throws Next\Tools\ClassMapper\ClassMapperException
  *   Output directory doesn't exist or it's not a valid directory
  *
  * @throws Next\Tools\ClassMapper\ClassMapperException
  *   Output directory is not writable
  *
  * @throws Next\Tools\ClassMapper\ClassMapperException
  *   Filename is missing
  */
 protected function checkIntegrity()
 {
     // If the root node name was overwritten with an empty string...
     if (empty($this->options->rootNode)) {
         throw new ClassMapperException('You must enter the the Top Level Node Name of XML File!');
     }
     // If we want to save the File...
     if ($this->options->save) {
         // ... an Output Directory must be set...
         if (empty($this->options->outputDirectory)) {
             throw ClassMapperException::noOutputDirectory();
         }
         // ... must exist
         if (!is_dir($this->options->outputDirectory)) {
             throw ClassMapperException::invalidOutputDirectory($this->options->outputDirectory);
         }
         // ... and must be writable
         if (!is_writable($this->options->outputDirectory)) {
             throw ClassMapperException::unwritableOutputDirectory($this->options->outputDirectory);
         }
         if ($this->options->save) {
             if (empty($this->options->filename)) {
                 throw ClassMapperException::missingOutputFilename();
             }
         }
     }
 }