dirextoryExists() public method

public dirextoryExists ( $directory ) : boolean
$directory
return boolean
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $destination = rtrim($input->getArgument('destination'), '/\\');
     if (!$this->filesystem->dirextoryExists($destination)) {
         throw new RunTimeException(sprintf('The destination %s does not exist.', $destination));
     }
     $wsdl = $input->getOption('wsdl');
     if (!$wsdl) {
         throw new RuntimeException('You MUST specify a WSDL endpoint.');
     }
     $namespace = $input->getOption('namespace');
     $soapClient = new SoapClient($wsdl, []);
     $types = $soapClient->getSoapTypes();
     $generator = new TypeGenerator($namespace);
     foreach ($types as $type => $properties) {
         // Check if file exists:
         $file = sprintf('%s/%s.php', $destination, ucfirst($type));
         $data = $generator->generate($type, $properties);
         // Existing files ...
         if ($this->filesystem->fileExists($file)) {
             $this->handleExistingFile($input, $output, $file, $type, $data);
             continue;
         }
         // New files...
         $this->filesystem->putFileContents($file, $data);
         $output->writeln(sprintf('Generated class %s to %s', $type, $file));
     }
     $output->writeln('Done');
 }
示例#2
0
 /**
  * @param Filesystem $filesystem
  * @param string     $tmpFolder
  */
 public function __construct(Filesystem $filesystem, $tmpFolder = '')
 {
     $this->filesystem = $filesystem;
     $this->tmpFolder = $tmpFolder ? rtrim($tmpFolder, '\\') : sys_get_temp_dir();
     if (!$filesystem->dirextoryExists($this->tmpFolder)) {
         throw new InvalidArgumentException(sprintf('The temporary directory %s is not writable', $this->tmpFolder));
     }
 }