From 7820ccdf9e13decf67ccfe0a2272138fafd98c20 Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Thu, 12 Feb 2015 13:30:32 +0000 Subject: [PATCH] Fixing FIXMEs --- PHPCI/Controller/BuildStatusController.php | 9 ++++++--- PHPCI/Helper/Github.php | 2 +- PHPCI/Plugin/PhpTalLint.php | 2 -- PHPCI/Plugin/SlackNotify.php | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/PHPCI/Controller/BuildStatusController.php b/PHPCI/Controller/BuildStatusController.php index 13b68cd8..06f9400b 100644 --- a/PHPCI/Controller/BuildStatusController.php +++ b/PHPCI/Controller/BuildStatusController.php @@ -84,9 +84,12 @@ class BuildStatusController extends \PHPCI\Controller } $color = ($status == 'passing') ? 'green' : 'red'; - - header('Content-Type: image/svg+xml'); - die(file_get_contents('http://img.shields.io/badge/build-' . $status . '-' . $color . '.svg')); + $image = file_get_contents('http://img.shields.io/badge/build-' . $status . '-' . $color . '.svg'); + + $this->response->disableLayout(); + $this->response->setHeader('Content-Type', 'image/svg+xml'); + $this->response->setContent($image); + return $this->response; } /** diff --git a/PHPCI/Helper/Github.php b/PHPCI/Helper/Github.php index b83b06c3..a791601e 100644 --- a/PHPCI/Helper/Github.php +++ b/PHPCI/Helper/Github.php @@ -79,7 +79,7 @@ class Github $token = Config::getInstance()->get('phpci.github.token'); if (!$token) { - die(json_encode(null)); + return null; } $cache = Cache::getCache(Cache::TYPE_APC); diff --git a/PHPCI/Plugin/PhpTalLint.php b/PHPCI/Plugin/PhpTalLint.php index 01e70b3e..146b0479 100644 --- a/PHPCI/Plugin/PhpTalLint.php +++ b/PHPCI/Plugin/PhpTalLint.php @@ -202,7 +202,6 @@ class PhpTalLint implements PHPCI\Plugin list($suffixes, $tales) = $this->getFlags(); - // FIXME: Find a way to clean this up $lint = dirname(__FILE__) . '/../../vendor/phptal/phptal/tools/phptal_lint.php'; $cmd = '/usr/bin/env php ' . $lint . ' %s %s "%s"'; @@ -210,7 +209,6 @@ class PhpTalLint implements PHPCI\Plugin $output = $this->phpci->getLastOutput(); - // FIXME: This is very messy, clean it up if (preg_match('/Found (.+?) (error|warning)/i', $output, $matches)) { $rows = explode(PHP_EOL, $output); diff --git a/PHPCI/Plugin/SlackNotify.php b/PHPCI/Plugin/SlackNotify.php index 1e1e3961..65a190fd 100644 --- a/PHPCI/Plugin/SlackNotify.php +++ b/PHPCI/Plugin/SlackNotify.php @@ -120,7 +120,7 @@ class SlackNotify implements \PHPCI\Plugin $success = true; - $message->send(''); // FIXME: Handle errors + $message->send(''); return $success; }