. */ require_once 'phing/tasks/system/condition/ConditionBase.php'; /** * task as a generalization of * *

This task supports boolean logic as well as pluggable conditions * to decide, whether a property should be set.

* *

This task does not extend Task to take advantage of * ConditionBase.

* * @author Andreas Aderhold * @copyright © 2001,2002 THYRELL. All rights reserved * @version $Revision: 905 $ $Date: 2010-10-05 18:28:03 +0200 (Tue, 05 Oct 2010) $ * @access public * @package phing.tasks.system */ class ConditionTask extends ConditionBase { private $property; private $value = "true"; /** * The name of the property to set. Required. */ function setProperty($p) { $this->property = $p; } /** * The value for the property to set. Defaults to "true". */ function setValue($v) { $this->value = $v; } /** * See whether our nested condition holds and set the property. */ function main() { if ($this->countConditions() > 1) { throw new BuildException("You must not nest more than one condition into "); } if ($this->countConditions() < 1) { throw new BuildException("You must nest a condition into "); } $cs = $this->getIterator(); if ($cs->current()->evaluate()) { $this->project->setProperty($this->property, $this->value); } } }