phing-tasks-system

# Class: IfTask Source Location: /tasks/system/IfTask.php
### Class Overview
    ProjectComponent
       |
       --ConditionBase
          |
          --IfTask
Perform some tasks based on whether a given condition holds true or not. #### Author(s): <href="mailto:stefan.bodewig@freenet.de" a href="mailto:stefan.bodewig@freenet.de">Stefan Bodewig</a> #### Version: $Revision: 557 $ #### Copyright: © 2001,2002 THYRELL. All rights reserved | ### Methods addElse addElseIf addThen main
### Inherited Variables #### Class: ConditionBase ConditionBase::$conditions #### Class: ProjectComponent ProjectComponent::$project | ### Inherited Methods #### Class: ConditionBase ConditionBase::addAvailable() ConditionBase::countConditions() ConditionBase::createAnd() ConditionBase::createContains() ConditionBase::createEquals() ConditionBase::createIsFalse() ConditionBase::createIsSet() ConditionBase::createIsTrue() ConditionBase::createNot() ConditionBase::createOr() ConditionBase::createOs() ConditionBase::createReferenceExists() ConditionBase::getConditions() ConditionBase::getIterator() Required for IteratorAggregate #### Class: ProjectComponent ProjectComponent::getProject() Returns a reference to current project ProjectComponent::log() Logs a message with the given priority. ProjectComponent::setProject() References the project to the current component.
### Class Details [line 110] Perform some tasks based on whether a given condition holds true or not. This task is heavily based on the Condition framework that can be found in Ant 1.4 and later, therefore it cannot be used in conjunction with versions of Ant prior to 1.4. This task doesn't have any attributes, the condition to test is specified by a nested element - see the documentation of your <condition&gt; task (see <a href="http://jakarta.apache.org/ant/manual/CoreTasks/condition.html">the online documentation</a> for example) for a complete list of nested elements. Just like the <condition&gt; task, only a single condition can be specified - you combine them using <and&gt; or <or&gt; conditions. In addition to the condition, you can specify three different child elements, <elseif&gt; , <then&gt; and <else&gt; . All three subelements are optional. Both <then&gt; and <else&gt; must not be used more than once inside the if task. Both are containers for Ant tasks, just like Ant's <parallel&gt; and <sequential&gt; tasks - in fact they are implemented using the same class as Ant's <sequential&gt; task. The <elseif&gt; behaves exactly like an <if&gt; except that it cannot contain the <else&gt; element inside of it. You may specify as may of these as you like, and the order they are specified is the order they are evaluated in. If the condition on the <if&gt; is false, then the first <elseif&gt; who's conditional evaluates to true will be executed. The <else&gt; will be executed only if the <if&gt; and all <elseif&gt; conditions are false. Use the following task to define the <if&gt; task before you use it the first time:
<h3>Crude Example</h3> <if> <equals arg1="${foo}" arg2="bar" /> <then> <echo message="The value of property foo is bar" /> </then> <else> <echo message="The value of property foo is not bar" /> </else> </if> <if> <equals arg1="${foo}" arg2="bar" /&gt; <then> <echo message="The value of property foo is 'bar'" /> </then> <elseif> <equals arg1="${foo}" arg2="foo" /> <then> <echo message="The value of property foo is 'foo'" /> </then> </elseif> <else> <echo message="The value of property foo is not 'foo' or 'bar'" /> </else> </if> #### Tags:
author: | <href="mailto:stefan.bodewig@freenet.de" a href="mailto:stefan.bodewig@freenet.de">Stefan Bodewig</a>
version: | $Revision: 557 $
copyright: | © 2001,2002 THYRELL. All rights reserved
[ Top ] ### Class Methods ### method addElse [line 144]
`void addElse( SequentialTask $e)`
A nested <else> element - a container of tasks that will be run if the condition doesn't hold true. Not required. #### Tags:
access: | public
#### Parameters:
SequentialTask | $e |
[ Top ] ### method addElseIf [line 120]
`void addElseIf( $ei)`
* A nested Else if task #### Tags:
access: | public
#### Parameters:
ElseIfTask | $ei |
[ Top ] ### method addThen [line 131]
`void addThen( SequentialTask $t)`
A nested <then> element - a container of tasks that will be run if the condition holds true. Not required. #### Tags:
access: | public
#### Parameters:
SequentialTask | $t |
[ Top ] ### method main [line 151]
`void main( )`
#### Tags:
access: | public
[ Top ] Documentation generated on Mon, 19 Oct 2009 10:51:03 +0200 by phpDocumentor 1.4.3