From ddb38fbd35579a81ed311069baccb89576c5ccac Mon Sep 17 00:00:00 2001 From: Bas Kamer Date: Fri, 30 Jan 2015 16:59:41 +0100 Subject: [PATCH] allow multiple targets --- src/Service/Phing.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/Service/Phing.php b/src/Service/Phing.php index 892ed28..1ca2e6f 100644 --- a/src/Service/Phing.php +++ b/src/Service/Phing.php @@ -48,11 +48,11 @@ public function setPhingOptions(PhingOptions $phingOptions) /** * - * @param type $target + * @param string $target * @param null|array|Traversable $options - * @return type + * @return array */ - public function build($target = null, $options = null) + public function build($target = "", $options = null) { $phingOptions = clone $this->phingOptions; @@ -70,7 +70,12 @@ public function build($target = null, $options = null) return $this->doBuild($target, $phingOptions); } - protected function doBuild($target, PhingOptions $options) + /** + * @param string $targets space separated list of targets + * @param PhingOptions $options + * @return array + */ + protected function doBuild($targets, PhingOptions $options) { if (!self::hasExec()) { throw new \RuntimeException("Not able to use PHP's exec method"); @@ -85,7 +90,11 @@ protected function doBuild($target, PhingOptions $options) $builder->setEnv($key, $value); } - $builder->add($target); + foreach(explode(' ', $targets) as $target) { + if (strlen(trim($target))) { + $builder->add(trim($target)); + } + } $process = $builder->getProcess();