Extended shields.io status badge support
This commit is contained in:
parent
3ca1667f12
commit
fd94e16cb6
|
@ -75,6 +75,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)) {
|
||||
|
@ -84,7 +87,7 @@ 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('http://img.shields.io/badge/' . $label . '-' . $status . '-' . $color . '.svg?style=' . $style);
|
||||
|
||||
$this->response->disableLayout();
|
||||
$this->response->setHeader('Content-Type', 'image/svg+xml');
|
||||
|
|
Loading…
Reference in a new issue