public function equals(Version $version) { return strtolower($version->getName()) === strtolower($this->getName()) && strtolower($version->getNormalizedVersion()) === strtolower($this->getNormalizedVersion()); }
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; } }
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'; }