diff options
Diffstat (limited to 'buildscripts/phing/classes/phing/tasks/system/condition')
12 files changed, 0 insertions, 815 deletions
diff --git a/buildscripts/phing/classes/phing/tasks/system/condition/AndCondition.php b/buildscripts/phing/classes/phing/tasks/system/condition/AndCondition.php deleted file mode 100644 index c16ce499..00000000 --- a/buildscripts/phing/classes/phing/tasks/system/condition/AndCondition.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/* - * $Id: AndCondition.php 59 2006-04-28 14:49:47Z mrook $ - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information please see - * <http://phing.info>. - */ - -require_once 'phing/tasks/system/condition/ConditionBase.php'; - -/** - * <and> condition container. - * - * Iterates over all conditions and returns false as soon as one - * evaluates to false. - * - * @author Hans Lellelid <hans@xmpl.org> - * @author Andreas Aderhold <andi@binarycloud.com> - * @copyright © 2001,2002 THYRELL. All rights reserved - * @version $Revision: 1.7 $ - * @package phing.tasks.system.condition - */ -class AndCondition extends ConditionBase implements Condition { - - public function evaluate() { - foreach($this as $c) { // ConditionBase implements IteratorAggregator - if (!$c->evaluate()) { - return false; - } - } - return true; - } -} diff --git a/buildscripts/phing/classes/phing/tasks/system/condition/Condition.php b/buildscripts/phing/classes/phing/tasks/system/condition/Condition.php deleted file mode 100644 index 73e0c232..00000000 --- a/buildscripts/phing/classes/phing/tasks/system/condition/Condition.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -/* - * $Id: Condition.php 59 2006-04-28 14:49:47Z mrook $ - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information please see - * <http://phing.info>. - */ - -/** - * Condition interface specification: - * - * Each condition must implement a method applying to this prototye: - * - * @author Hans Lellelid <hans@xmpl.org> - * @version $Revision: 1.4 $ - * @package phing.tasks.system.condition - */ -interface Condition { - /** - * @return boolean - * @throws BuildException - */ - public function evaluate(); -} -?>
\ No newline at end of file diff --git a/buildscripts/phing/classes/phing/tasks/system/condition/ConditionBase.php b/buildscripts/phing/classes/phing/tasks/system/condition/ConditionBase.php deleted file mode 100644 index 1c09fe49..00000000 --- a/buildscripts/phing/classes/phing/tasks/system/condition/ConditionBase.php +++ /dev/null @@ -1,195 +0,0 @@ -<?php -/* - * $Id: ConditionBase.php 59 2006-04-28 14:49:47Z mrook $ - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information please see - * <http://phing.info>. - */ - -require_once 'phing/ProjectComponent.php'; -include_once 'phing/Project.php'; -include_once 'phing/tasks/system/AvailableTask.php'; -include_once 'phing/tasks/system/condition/Condition.php'; - -/** - * Abstract baseclass for the <condition> task as well as several - * conditions - ensures that the types of conditions inside the task - * and the "container" conditions are in sync. - * - * @author Hans Lellelid <hans@xmpl.org> - * @author Andreas Aderhold <andi@binarycloud.com> - * @copyright © 2001,2002 THYRELL. All rights reserved - * @version $Revision: 1.16 $ - * @package phing.tasks.system.condition - */ -abstract class ConditionBase extends ProjectComponent implements IteratorAggregate { - - public $conditions = array(); // needs to be public for "inner" class access - - function countConditions() { - return count($this->conditions); - } - - /** - * Required for IteratorAggregate - */ - function getIterator() { - return new ConditionEnumeration($this); - } - - function getConditions() { - return $this->conditions; - } - - /** - * @return void - */ - function addAvailable(AvailableTask $a) { - $this->conditions[] = $a; - } - - /** - * @return NotCondition - */ - function createNot() { - include_once 'phing/tasks/system/condition/NotCondition.php'; - $num = array_push($this->conditions, new NotCondition()); - return $this->conditions[$num-1]; - } - - /** - * @return AndCondition - */ - function createAnd() { - include_once 'phing/tasks/system/condition/AndCondition.php'; - $num = array_push($this->conditions, new AndCondition()); - return $this->conditions[$num-1]; - } - - /** - * @return OrCondition - */ - function createOr() { - include_once 'phing/tasks/system/condition/OrCondition.php'; - $num = array_push($this->conditions, new OrCondition()); - return $this->conditions[$num-1]; - } - - /** - * @return EqualsCondition - */ - function createEquals() { - include_once 'phing/tasks/system/condition/EqualsCondition.php'; - $num = array_push($this->conditions, new EqualsCondition()); - return $this->conditions[$num-1]; - } - - /** - * @return OsCondition - */ - function createOs() { - include_once 'phing/tasks/system/condition/OsCondition.php'; - $num = array_push($this->conditions, new OsCondition()); - return $this->conditions[$num-1]; - } - - /** - * @return IsFalseCondition - */ - function createIsFalse() { - include_once 'phing/tasks/system/condition/IsFalseCondition.php'; - $num = array_push($this->conditions, new IsFalseCondition()); - return $this->conditions[$num-1]; - } - - /** - * @return IsTrueCondition - */ - function createIsTrue() { - include_once 'phing/tasks/system/condition/IsTrueCondition.php'; - $num = array_push($this->conditions, new IsTrueCondition()); - return $this->conditions[$num-1]; - } - - /** - * @return ContainsCondition - */ - function createContains() { - include_once 'phing/tasks/system/condition/ContainsCondition.php'; - $num = array_push($this->conditions, new ContainsCondition()); - return $this->conditions[$num-1]; - } - - /** - * @return IsSetCondition - */ - function createIsSet() { - include_once 'phing/tasks/system/condition/IsSetCondition.php'; - $num = array_push($this->conditions, new IsSetCondition()); - return $this->conditions[$num-1]; - } - - /** - * @return ReferenceExistsCondition - */ - function createReferenceExists() { - include_once 'phing/tasks/system/condition/ReferenceExistsCondition.php'; - $num = array_push($this->conditions, new ReferenceExistsCondition()); - return $this->conditions[$num-1]; - } - -} - -/** - * "Inner" class for handling enumerations. - * Uses build-in PHP5 iterator support. - */ -class ConditionEnumeration implements Iterator { - - /** Current element number */ - private $num = 0; - - /** "Outer" ConditionBase class. */ - private $outer; - - function __construct(ConditionBase $outer) { - $this->outer = $outer; - } - - public function valid() { - return $this->outer->countConditions() > $this->num; - } - - function current() { - $o = $this->outer->conditions[$this->num]; - if ($o instanceof ProjectComponent) { - $o->setProject($this->outer->getProject()); - } - return $o; - } - - function next() { - $this->num++; - } - - function key() { - return $this->num; - } - - function rewind() { - $this->num = 0; - } -} diff --git a/buildscripts/phing/classes/phing/tasks/system/condition/ContainsCondition.php b/buildscripts/phing/classes/phing/tasks/system/condition/ContainsCondition.php deleted file mode 100644 index 95849cd8..00000000 --- a/buildscripts/phing/classes/phing/tasks/system/condition/ContainsCondition.php +++ /dev/null @@ -1,76 +0,0 @@ -<?php - -/* - * $Id: ContainsCondition.php 59 2006-04-28 14:49:47Z mrook $ - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information please see - * <http://phing.info>. - */ - -require_once 'phing/tasks/system/condition/Condition.php'; - -/** - * Is one string part of another string? - * - * @author Hans Lellelid <hans@xmpl.org> (Phing) - * @author Stefan Bodewig <stefan.bodewig@epost.de> (Ant) - * @version $Revision: 1.3 $ - * @package phing.tasks.system.condition - */ -class ContainsCondition implements Condition { - - private $string; - private $subString; - private $caseSensitive = true; - - /** - * The string to search in. - * @param string $a1 - */ - public function setString($a1) { - $this->string = $a1; - } - - /** - * The string to search for. - * @param string $a2 - */ - public function setSubstring($a2) { - $this->subString = $a2; - } - - /** - * Whether to search ignoring case or not. - */ - public function setCaseSensitive($b) { - $this->caseSensitive = (boolean) $b; - } - - /** - * Check whether string contains substring. - * @throws BuildException - */ - public function evaluate() { - if ($this->string === null || $this->subString === null) { - throw new BuildException("both string and substring are required " - . "in contains"); - } - - return $this->caseSensitive - ? strpos($this->string, $this->subString) !== false - : substr(strtolower($this->string), strtolower($this->subString)) !== false; - } -} diff --git a/buildscripts/phing/classes/phing/tasks/system/condition/EqualsCondition.php b/buildscripts/phing/classes/phing/tasks/system/condition/EqualsCondition.php deleted file mode 100644 index 32d51380..00000000 --- a/buildscripts/phing/classes/phing/tasks/system/condition/EqualsCondition.php +++ /dev/null @@ -1,78 +0,0 @@ -<?php -/* - * $Id: EqualsCondition.php 59 2006-04-28 14:49:47Z mrook $ - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information please see - * <http://phing.info>. - */ - -require_once 'phing/tasks/system/condition/Condition.php'; - -/** - * A simple string comparator. Compares two strings for eqiality in a - * binary safe manner. Implements the condition interface specification. - * - * @author Andreas Aderhold <andi@binarycloud.com> - * @copyright © 2001,2002 THYRELL. All rights reserved - * @version $Revision: 1.7 $ $Date: 2006-04-28 10:49:47 -0400 (Fri, 28 Apr 2006) $ - * @access public - * @package phing.tasks.system.condition - */ -class EqualsCondition implements Condition { - - private $arg1; - private $arg2; - private $trim = false; - private $caseSensitive = true; - - public function setArg1($a1) { - $this->arg1 = $a1; - } - - public function setArg2($a2) { - $this->arg2 = $a2; - } - - /** - * Should we want to trim the arguments before comparing them? - * @param boolean $b - */ - public function setTrim($b) { - $this->trim = (boolean) $b; - } - - /** - * Should the comparison be case sensitive? - * @param boolean $b - */ - public function setCaseSensitive($b) { - $this->caseSensitive = (boolean) $b; - } - - public function evaluate() { - if ($this->arg1 === null || $this->arg2 === null) { - throw new BuildException("Both arg1 and arg2 are required in equals."); - } - - if ($this->trim) { - $this->arg1 = trim($this->arg1); - $this->arg2 = trim($this->arg2); - } - - //print("[comparison] Comparing '".$this->arg1."' and '".$this->arg2."'\n"); - return $this->caseSensitive ? $this->arg1 === $this->arg2 : strtolower($this->arg1) === strtolower($this->arg2); - } -} diff --git a/buildscripts/phing/classes/phing/tasks/system/condition/IsFalseCondition.php b/buildscripts/phing/classes/phing/tasks/system/condition/IsFalseCondition.php deleted file mode 100644 index ebbd1a3d..00000000 --- a/buildscripts/phing/classes/phing/tasks/system/condition/IsFalseCondition.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php -/* - * $Id: IsFalseCondition.php 59 2006-04-28 14:49:47Z mrook $ - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information please see - * <http://phing.info>. - */ - -require_once 'phing/ProjectComponent.php'; -require_once 'phing/tasks/system/condition/Condition.php'; - -/** - * Condition that tests whether a given string evals to false. - * - * @author Hans Lellelid (Phing) - * @author Steve Loughran (Ant) - * @version $Revision: 1.4 $ - * @package phing.tasks.system.condition - */ -class IsFalseCondition extends ProjectComponent implements Condition { - - /** - * what we eval - */ - private $value; - - /** - * Set the value to be tested. - * @param boolean $value - */ - public function setValue($value) { - $this->value = $value; - } - - /** - * return the inverted value; - * @throws BuildException if someone forgot to spec a value - */ - public function evaluate() { - if ($this->value === null) { - throw new BuildException("Nothing to test for falsehood"); - } - return !$this->value; - } - -} - diff --git a/buildscripts/phing/classes/phing/tasks/system/condition/IsSetCondition.php b/buildscripts/phing/classes/phing/tasks/system/condition/IsSetCondition.php deleted file mode 100644 index 4f81c50f..00000000 --- a/buildscripts/phing/classes/phing/tasks/system/condition/IsSetCondition.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php -/* - * $Id: IsSetCondition.php 59 2006-04-28 14:49:47Z mrook $ - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information please see - * <http://phing.info>. - */ - -require_once 'phing/ProjectComponent.php'; -require_once 'phing/tasks/system/condition/Condition.php'; - -/** - * Condition that tests whether a given property has been set. - * - * @author Hans Lellelid <hans@xmpl.org> (Phing) - * @author Stefan Bodewig <stefan.bodewig@epost.de> (Ant) - * @version $Revision: 1.4 $ - * @package phing.tasks.system.condition - */ -class IsSetCondition extends ProjectComponent implements Condition { - - private $property; - - public function setProperty($p) { - $this->property = $p; - } - - /** - * Check whether property is set. - * @throws BuildException - */ - public function evaluate() { - if ($this->property === null) { - throw new BuildException("No property specified for isset " - . "condition"); - } - return $this->project->getProperty($this->property) !== null; - } - -} diff --git a/buildscripts/phing/classes/phing/tasks/system/condition/IsTrueCondition.php b/buildscripts/phing/classes/phing/tasks/system/condition/IsTrueCondition.php deleted file mode 100644 index 4affefc5..00000000 --- a/buildscripts/phing/classes/phing/tasks/system/condition/IsTrueCondition.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php -/* - * $Id: IsTrueCondition.php 59 2006-04-28 14:49:47Z mrook $ - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information please see - * <http://phing.info>. - */ - -require_once 'phing/ProjectComponent.php'; -require_once 'phing/tasks/system/condition/Condition.php'; - -/** - * Condition that tests whether a given string evals to true. - * - * @author Hans Lellelid <hans@xmpl.org> (Phing) - * @author Steve Loughran (Ant) - * @package phing.tasks.system.condition - */ -class IsTrueCondition extends ProjectComponent implements Condition { - - /** - * what we eval - */ - private $value; - - /** - * Set the value to be tested. - * @param boolean $value - */ - public function setValue($value) { - $this->value = $value; - } - - /** - * return the inverted value; - * @throws BuildException if someone forgot to spec a value - */ - public function evaluate() { - if ($this->value === null) { - throw new BuildException("Nothing to test for falsehood"); - } - return $this->value; - } - -} - diff --git a/buildscripts/phing/classes/phing/tasks/system/condition/NotCondition.php b/buildscripts/phing/classes/phing/tasks/system/condition/NotCondition.php deleted file mode 100644 index c76ef2b8..00000000 --- a/buildscripts/phing/classes/phing/tasks/system/condition/NotCondition.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php -/* - * $Id: NotCondition.php 59 2006-04-28 14:49:47Z mrook $ - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information please see - * <http://phing.info>. - */ - -require_once 'phing/tasks/system/condition/ConditionBase.php'; - -/** - * <not> condition. - * - * Evaluates to true if the single condition nested into it is false - * and vice versa. - * - * @author Andreas Aderhold <andi@binarycloud.com> - * @copyright © 2001,2002 THYRELL. All rights reserved - * @version $Revision: 1.6 $ $Date: 2006-04-28 10:49:47 -0400 (Fri, 28 Apr 2006) $ - * @access public - * @package phing.tasks.system.condition - */ -class NotCondition extends ConditionBase implements Condition { - - function evaluate() { - if ($this->countConditions() > 1) { - throw new BuildException("You must not nest more than one condition into <not>"); - } - if ($this->countConditions() < 1) { - throw new BuildException("You must nest a condition into <not>"); - } - $conds = $this->getIterator(); - return !$conds->current()->evaluate(); - } -} diff --git a/buildscripts/phing/classes/phing/tasks/system/condition/OrCondition.php b/buildscripts/phing/classes/phing/tasks/system/condition/OrCondition.php deleted file mode 100644 index 778abfd0..00000000 --- a/buildscripts/phing/classes/phing/tasks/system/condition/OrCondition.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/* - * $Id: OrCondition.php 59 2006-04-28 14:49:47Z mrook $ - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information please see - * <http://phing.info>. - */ - -require_once 'phing/tasks/system/condition/ConditionBase.php'; - -/** - * <or> condition container. - * - * Iterates over all conditions and returns true as soon as one - * evaluates to true. - * - * @author Andreas Aderhold <andi@binarycloud.com> - * @copyright 2001,2002 THYRELL. All rights reserved - * @version $Revision: 1.8 $ $Date: 2006-04-28 10:49:47 -0400 (Fri, 28 Apr 2006) $ - * @access public - * @package phing.tasks.system.condition - */ -class OrCondition extends ConditionBase implements Condition { - - function evaluate() { - foreach($this as $c) { // ConditionBase implements IteratorAggregator - if ($c->evaluate()) { - return true; - } - } - return false; - } -} diff --git a/buildscripts/phing/classes/phing/tasks/system/condition/OsCondition.php b/buildscripts/phing/classes/phing/tasks/system/condition/OsCondition.php deleted file mode 100644 index d80729e7..00000000 --- a/buildscripts/phing/classes/phing/tasks/system/condition/OsCondition.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php -/* - * $Id: OsCondition.php 59 2006-04-28 14:49:47Z mrook $ - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information please see - * <http://phing.info>. - */ - -require_once 'phing/tasks/system/condition/ConditionBase.php'; - -/** - * Condition that tests the OS type. - * - * @author Andreas Aderhold <andi@binarycloud.com> - * @copyright © 2001,2002 THYRELL. All rights reserved - * @version $Revision: 1.8 $ $Date: 2006-04-28 10:49:47 -0400 (Fri, 28 Apr 2006) $ - * @access public - * @package phing.tasks.system.condition - */ -class OsCondition implements Condition { - - private $family; - - function setFamily($f) { - $this->family = strtolower($f); - } - - function evaluate() { - $osName = strtolower(Phing::getProperty("os.name")); - - if ($this->family !== null) { - if ($this->family === "windows") { - return StringHelper::startsWith("win", $osName); - } elseif ($this->family === "mac") { - return (strpos($osName, "mac") !== false || strpos($osName, "darwin") !== false); - } elseif ($this->family === ("unix")) { - return ( - StringHelper::endsWith("ix", $osName) || - StringHelper::endsWith("ux", $osName) || - StringHelper::endsWith("bsd", $osName) || - StringHelper::startsWith("sunos", $osName) || - StringHelper::startsWith("darwin", $osName) - ); - } - throw new BuildException("Don't know how to detect os family '" . $this->family . "'"); - } - return false; - } - -} diff --git a/buildscripts/phing/classes/phing/tasks/system/condition/ReferenceExistsCondition.php b/buildscripts/phing/classes/phing/tasks/system/condition/ReferenceExistsCondition.php deleted file mode 100644 index 09324fb8..00000000 --- a/buildscripts/phing/classes/phing/tasks/system/condition/ReferenceExistsCondition.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php -/* - * $Id: ReferenceExistsCondition.php 59 2006-04-28 14:49:47Z mrook $ - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information please see - * <http://phing.info>. - */ - -require_once 'phing/ProjectComponent.php'; require_once 'phing/tasks/system/condition/Condition.php'; - -/** - * Condition that tests whether a given reference exists. - * - * @author Matthias Pigulla <mp@webfactory.de> (Phing) - * @version $Revision: 1.1 $ - * @package phing.tasks.system.condition */ -class ReferenceExistsCondition extends ProjectComponent implements Condition { - - private $refid; - - public function setRef($id) { - $this->refid = (string) $id; - } - - /** - * Check whether the reference exists. - * @throws BuildException - */ - public function evaluate() { - if ($this->refid === null) { - throw new BuildException("No ref attribute specified for reference-exists " - . "condition"); - } - $refs = $this->project->getReferences(); - return isset($refs[$this->refid]); - } - -} - |