From 6917e88f9b3f31c4f4448dd92df34928f0bdd034 Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Wed, 16 Apr 2014 09:05:48 +0100 Subject: [PATCH] Adding global try/catch in Builder, in hope of fixing forever-hanging. Closes #354, Closes #304 --- PHPCI/Builder.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/PHPCI/Builder.php b/PHPCI/Builder.php index 04c5c48e..92b43e9d 100644 --- a/PHPCI/Builder.php +++ b/PHPCI/Builder.php @@ -136,16 +136,22 @@ class Builder implements LoggerAwareInterface /** * Set the config array, as read from phpci.yml - * @param array + * @param array|null $config + * @throws \Exception */ - public function setConfigArray(array $config) + public function setConfigArray($config) { + if (is_null($config) || !is_array($config)) { + throw new \Exception('This project does not contain a phpci.yml file, or it is empty.'); + } + $this->config = $config; } /** * Access a variable from the phpci.yml file. * @param string + * @return mixed */ public function getConfig($key) {