Skip to content

Commit

Permalink
improved stable:no-relase
Browse files Browse the repository at this point in the history
  • Loading branch information
liuggio committed Aug 30, 2013
1 parent 779838d commit cc8ff2f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/PUGX/BadgeBundle/Controller/BadgeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public function versionAction($repository, $latest = 'stable')
if ('stable' == $latest && $package->hasStableVersion()) {
$image = $this->container->get('image_creator')->createStableImage($package->getLatestStableVersion());
} else if ('stable' == $latest) {

$image = $this->container->get('image_creator')->createNoStableImage(self::TEXT_NO_STABLE_RELEASE);
} else if ($package->hasUnstableVersion()) {
$image = $this->container->get('image_creator')->createUnstableImage($package->getLatestUnstableVersion());
}
Expand All @@ -133,7 +133,7 @@ public function versionAction($repository, $latest = 'stable')
$error = self::ERROR_TEXT_GENERIC;
}

if (null == $image) {
if (null === $image) {
$image = $this->container->get('image_creator')->createErrorImage($error);
$latest = 'error';
}
Expand Down
15 changes: 15 additions & 0 deletions src/PUGX/BadgeBundle/Service/ImageCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,21 @@ public function createStableImage($value)
return $this->addShadowedText($image, $value, 51);
}

/**
* Create the 'stable:no release' image with the standard Font and stable image template.
*
* @param string $value
*
* @return ImageInterface
*/
public function createNoStableImage($value)
{
$imagePath = $this->imagePath . DIRECTORY_SEPARATOR . $this->imageNames['stable'];
$image = $this->createImage($imagePath);

return $this->addShadowedText($image, $value, 51, null, 8, $this->fontPath . DIRECTORY_SEPARATOR . 'DroidSans.ttf');
}

/**
* Create the 'stable' image with the standard Font and unstable image template.
*
Expand Down

0 comments on commit cc8ff2f

Please sign in to comment.