示例#1
0
 public function equals(Version $version)
 {
     return strtolower($version->getName()) === strtolower($this->getName()) && strtolower($version->getNormalizedVersion()) === strtolower($this->getNormalizedVersion());
 }
示例#2
0
 private function dumpVersionToIndividualFile(Version $version, $file, $key)
 {
     $this->loadIndividualFile($file, $key);
     $data = $version->toArray();
     $data['uid'] = $version->getId();
     $this->individualFiles[$key]['packages'][strtolower($version->getName())][$version->getVersion()] = $data;
     $timestamp = $version->getReleasedAt() ? $version->getReleasedAt()->getTimestamp() : time();
     if (!isset($this->individualFilesMtime[$key]) || $this->individualFilesMtime[$key] < $timestamp) {
         $this->individualFilesMtime[$key] = $timestamp;
     }
 }
示例#3
0
 private function getTargetFile(Version $version)
 {
     if ($version->isDevelopment()) {
         $distribution = 16;
         return 'packages-dev-' . chr(abs(crc32($version->getName())) % $distribution + 97) . '.json';
     }
     $date = $version->getReleasedAt();
     return 'packages-' . ($date->format('Y') === date('Y') ? $date->format('Y-m') : $date->format('Y')) . '.json';
 }