Пример #1
0
 protected function setPackageDist(Interfaces\Package $package, array $config)
 {
     if (!isset($config['dist'])) {
         return;
     }
     if (!isset($config['dist']['type']) || !isset($config['dist']['url'])) {
         throw new \UnexpectedValueException(sprintf("Package %s's dist key should be specified as " . "{\"type\": ..., \"url\": ..., \"reference\": ..., \"shasum\": ...},\n%s given.", $config['name'], json_encode($config['dist'])));
     }
     $package->setDistType($config['dist']['type']);
     $package->setDistUrl($config['dist']['url']);
     $package->setDistReference(isset($config['dist']['reference']) ? $config['dist']['reference'] : null);
     $package->setDistSha1Checksum(isset($config['dist']['shasum']) ? $config['dist']['shasum'] : null);
     if (isset($config['dist']['mirrors'])) {
         $package->setDistMirrors($config['dist']['mirrors']);
     }
 }