/** * Will be called from the Vinelab\Cdn\EmptyCommand class on Fire(). */ public function emptyBucket() { // return the configurations from the config file $configurations = $this->helper->getConfigurations(); // return an instance of the corresponding Provider concrete according to the configuration $provider = $this->provider_factory->create($configurations); return $provider->emptyBucket(); }
/** * Read the configuration file and pass it to the provider factory * to return an object of the default provider specified in the * config file. */ private function init() { // return the configurations from the config file $this->configurations = $this->helper->getConfigurations(); // return an instance of the corresponding Provider concrete according to the configuration $this->provider = $this->provider_factory->create($this->configurations); }
/** * This function will be called from the CdnFacade class when * someone use this {{ Cdn::asset('') }} facade helper. * * @param $path * * @return string */ public function urlGenerator($path) { if ($this->getCloudFront() === true) { $url = $this->cdn_helper->parseUrl($this->getCloudFrontUrl()); return $url['scheme'] . '://' . $url['host'] . '/' . $path; } $url = $this->cdn_helper->parseUrl($this->getUrl()); $bucket = $this->getBucket(); $bucket = !empty($bucket) ? $bucket . '.' : ''; return $url['scheme'] . '://' . $bucket . $url['host'] . '/' . $path; }