toArray() public method

Return keywords list.
public toArray ( ) : array
return array
Ejemplo n.º 1
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);
     }
 }