/** * @param array $config * @param string $package * * @return \Pickle\Base\Interfaces\Package $package */ public function load(array $config, $package = 'Pickle\\Base\\Interfaces\\Package') { if (isset($config['version'])) { $version = $this->versionParser->normalize($config['version']); $package = Package::factory($config['name'], $version, $config['version'], true); } else { $package = Package::factory($config['name'], '', '', true); } if (isset($config['type']) && $config['type'] != 'extension') { throw new \UnexpectedValueException($package->getName() . ' is not a extension(s) package'); } $package->setType('extension'); $this->setPackageSource($package, $config); $this->setPackageDist($package, $config); $this->setPackageReleaseDate($package, $config); $this->setPackageStability($package, $config); $this->setPackageExtra($package, $config); $this->setPackageDescription($package, $config); $this->setPackageHomepage($package, $config); $this->setPackageKeywords($package, $config); $this->setPackageLicense($package, $config); $this->setPackageAuthors($package, $config); $this->setPackageSupport($package, $config); return $package; }
protected function fetch($target) { $package = Package::factory($this->name, $this->version, $this->prettyVersion); $package->setDistUrl($this->url); $package->setRootDir($target); $downloader = new TGZDownloader($this->io, new Config()); if (null !== $downloader) { $downloader->download($package, $target); } }
protected function fetch($target) { $package = Package::factory($this->name, $this->version, $this->prettyVersion); $package->setSourceType('git'); $package->setSourceUrl($this->url); $package->setSourceReference($this->version); $package->setRootDir($target); $downloader = new GitDownloader($this->io, new Config()); if (null !== $downloader) { $downloader->download($package, $target); } }