From 5c6dd81a9a2f9401fab85c8884b771ba4aa50efa Mon Sep 17 00:00:00 2001 From: corpsee Date: Thu, 30 Apr 2015 16:07:12 +0600 Subject: [PATCH] Extended shields.io status badge support Closed #958 --- PHPCI/Controller/BuildStatusController.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/PHPCI/Controller/BuildStatusController.php b/PHPCI/Controller/BuildStatusController.php index 62442bf8..0090e85f 100644 --- a/PHPCI/Controller/BuildStatusController.php +++ b/PHPCI/Controller/BuildStatusController.php @@ -131,6 +131,9 @@ class BuildStatusController extends \PHPCI\Controller */ public function image($projectId) { + $style = $this->getParam('style', 'plastic'); + $label = $this->getParam('label', 'build'); + $status = $this->getStatus($projectId); if (is_null($status)) { @@ -140,7 +143,13 @@ class BuildStatusController extends \PHPCI\Controller } $color = ($status == 'passing') ? 'green' : 'red'; - $image = file_get_contents('http://img.shields.io/badge/build-' . $status . '-' . $color . '.svg'); + $image = file_get_contents(sprintf( + 'http://img.shields.io/badge/%s-%s-%s.svg?style=%s', + $label, + $status, + $color, + $style + )); $this->response->disableLayout(); $this->response->setHeader('Content-Type', 'image/svg+xml');