getDestination() public method

public getDestination ( ) : string
return string
 /**
  * Make a verification.
  *
  * @param Package $package
  *
  * @throws ValidatorException
  *
  * @return void
  */
 public function verify(Package $package)
 {
     $path = $package->getDestination();
     if (is_dir($path) || is_file($path) || $path == getcwd()) {
         throw new ValidatorException('Package already exists!');
     }
 }
Esempio n. 2
0
 /**
  * Craft the application with parameters.
  *
  * @param Package $package
  *
  * @return mixed
  */
 public function craft(Package $package)
 {
     $stubPath = realpath(__DIR__ . '/../stubs');
     // set delimiters
     $this->stubber->withDelimiters('{{', '}}');
     // set keywords
     $this->stubber->setRaw($package->toArray());
     $this->filesystem->mirror($stubPath, $package->getDestination());
     // array of all stub files
     $stubFiles = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($package->getDestination(), \RecursiveDirectoryIterator::SKIP_DOTS));
     // find and replace
     foreach ($stubFiles as $stub) {
         $new = pathinfo($stub);
         $this->stubber->useStub($stub);
         if ($this->isConfigFile($new['basename'])) {
             $this->stubber->generate($new['dirname'] . '/' . Str::slug($package->getPackage()) . '.php');
         } elseif ($this->isServiceProviderFile($new['basename'])) {
             $this->stubber->generate($new['dirname'] . '/' . $package->getPackage() . 'ServiceProvider.php');
         } else {
             $this->stubber->generate($new['dirname'] . '/' . $new['filename']);
         }
         $this->filesystem->remove($stub);
     }
 }