createDirectory() public static method

public static createDirectory ( string $directory, integer $permissions = 509 ) : boolean
$directory string
$permissions integer
return boolean
コード例 #1
0
 /**
  * @see \WsdlToPhp\PackageGenerator\File\AbstractFile::writeFile()
  * @param bool $withSrc
  * @return int|bool
  */
 public function writeFile($withSrc = true)
 {
     if (!$this->getModel() instanceof AbstractModel) {
         throw new \InvalidArgumentException('You MUST define the model before begin able to generate the file', __LINE__);
     }
     GeneratorUtils::createDirectory($this->getFileDestination($withSrc));
     $this->defineNamespace()->defineUseStatement()->addAnnotationBlock()->addClassElement();
     return parent::writeFile();
 }
コード例 #2
0
 /**
  * @throws \InvalidArgumentException
  * @return Generator
  */
 protected function initDirectory()
 {
     Utils::createDirectory($this->getOptions()->getDestination());
     if (!is_writable($this->getOptionDestination())) {
         throw new \InvalidArgumentException(sprintf('Unable to use dir "%s" as dir does not exists, its creation has been impossible or it\'s not writable', $this->getOptionDestination()), __LINE__);
     }
     return $this;
 }
コード例 #3
0
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testExceptionOntInitDirectory()
 {
     Utils::createDirectory($destination = self::getTestDirectory() . 'notwritable', 0444);
     $generator = self::getBingGeneratorInstance();
     $generator->setOptionComposerName('wsdltophp/invalid')->setOptionDestination($destination);
     $generator->generatePackage();
 }