diff --git a/src/PUGX/BadgeBundle/Controller/BadgeController.php b/src/PUGX/BadgeBundle/Controller/BadgeController.php index ed553a31..caa6a6a9 100644 --- a/src/PUGX/BadgeBundle/Controller/BadgeController.php +++ b/src/PUGX/BadgeBundle/Controller/BadgeController.php @@ -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()); } @@ -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'; } diff --git a/src/PUGX/BadgeBundle/Service/ImageCreator.php b/src/PUGX/BadgeBundle/Service/ImageCreator.php index 6d88ba3a..6290f8fa 100644 --- a/src/PUGX/BadgeBundle/Service/ImageCreator.php +++ b/src/PUGX/BadgeBundle/Service/ImageCreator.php @@ -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. *