Exemplo n.º 1
0
 /**
  * @param Release $release
  *
  * @return array
  */
 protected function renderRelease(Release $release)
 {
     $date = null;
     if ($release->getDate() !== null) {
         $date = $release->getDate()->format('Y-m-d');
     }
     return ['name' => $release->getName(), 'link' => $release->getLink(), 'linkName' => $release->getLinkName(), 'date' => $date, 'changes' => $release->getAllChanges()];
 }
Exemplo n.º 2
0
 /**
  * @param SimpleXMLElement $releases
  * @param Release          $release
  */
 protected function renderRelease($releases, $release)
 {
     $releaseNode = $releases->addChild('release');
     $releaseNode->addChild('name', $release->getName());
     $releaseNode->addChild('link', $release->getLink());
     if ($release->getLinkName() !== null) {
         $releaseNode->addChild('linkName', $release->getLinkName());
     }
     if ($release->getDate() !== null) {
         $releaseNode->addChild('date', $release->getDate()->format('Y-m-d'));
     }
     $this->addChanges($releaseNode, $release);
 }
Exemplo n.º 3
0
 /**
  * Converts a Release into its text representation.
  *
  * @param Release $release
  *
  * @return string
  */
 public function renderRelease(Release $release)
 {
     $name = $release->getName();
     if ($release->getLink() !== null) {
         $name = "[{$name}]";
     }
     if ($release->getLinkName() !== null) {
         $name .= "[{$release->getLinkName()}]";
     }
     $content = "\n## {$name}";
     $content .= $this->addDate($release);
     $content .= $this->addYanked($release);
     $content .= "\n";
     foreach ($release->getAllChanges() as $type => $changes) {
         $content .= $this->renderType($type, $changes);
     }
     return substr($content, 0, strlen($content) - 1);
 }
Exemplo n.º 4
0
 /**
  * Adds a release to the Log.
  * Can be used to replace existing releases too.
  *
  * @param Release $release
  */
 public function addRelease(Release $release)
 {
     $name = strtolower($release->getName());
     $this->releases[$name] = $release;
     $this->sortReleases();
 }
Exemplo n.º 5
0
 public function testGetSetName()
 {
     $name = '1.0.0';
     $this->release->setName($name);
     $this->assertEquals($name, $this->release->getName());
 }