Пример #1
0
 /**
  * Populates a feed entry with data coming from Version objects.
  *
  * @param \Zend\Feed\Writer\Entry $entry
  * @param Version                 $version
  */
 protected function populateVersionData(Entry $entry, Version $version)
 {
     $entry->setTitle($entry->getTitle() . " ({$version->getVersion()})");
     $entry->setId($entry->getId() . ' ' . $version->getVersion());
     $entry->setDateModified($version->getReleasedAt());
     $entry->setDateCreated($version->getReleasedAt());
     foreach ($version->getAuthors() as $author) {
         /** @var $author \Packagist\WebBundle\Entity\Author */
         if ($author->getName()) {
             $entry->addAuthor(array('name' => $author->getName()));
         }
     }
 }
Пример #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';
 }