Esempio n. 1
0
File: Cdn.php Progetto: codenut/cdn
 /**
  * Will be called from the Vinelab\Cdn\PushCommand class on Fire().
  */
 public function push()
 {
     // return the configurations from the config file
     $configurations = $this->helper->getConfigurations();
     // Initialize an instance of the asset holder to read the configurations
     // then call the read(), to return all the allowed assets as a collection of files objects
     $assets = $this->finder->read($this->asset_holder->init($configurations));
     // store the returned assets in the instance of the asset holder as collection of paths
     $this->asset_holder->setAssets($assets);
     // return an instance of the corresponding Provider concrete according to the configuration
     $provider = $this->provider_factory->create($configurations);
     return $provider->upload($this->asset_holder->getAssets());
 }
Esempio n. 2
0
 /**
  * exclude the ignored directories and files.
  *
  * @param AssetInterface $asset_holder
  */
 private function excludeThis(AssetInterface $asset_holder)
 {
     // add or ignore hidden directories
     $this->ignoreDotFiles($asset_holder->getExcludeHidden());
     // exclude ignored files
     foreach ($asset_holder->getExcludedFiles() as $name) {
         $this->notName($name);
     }
     // exclude files (if exist) with this extensions
     $excluded_extensions = $asset_holder->getExcludedExtensions();
     if (!empty($excluded_extensions)) {
         foreach ($asset_holder->getExcludedExtensions() as $extension) {
             $this->notName('*' . $extension);
         }
     }
     // exclude the regex pattern
     foreach ($asset_holder->getExcludedPatterns() as $pattern) {
         $this->notName($pattern);
     }
 }