[ Index ]
 

Code source de Symfony 1.0.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/vendor/phing/tasks/system/ -> PhingCallTask.php (source)

   1  <?php
   2  /*
   3   *  $Id: PhingCallTask.php 3076 2006-12-18 08:52:12Z fabien $  
   4   * 
   5   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   6   * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   7   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   8   * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   9   * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  10   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  11   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  12   * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  13   * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  14   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  15   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  16   *
  17   * This software consists of voluntary contributions made by many individuals
  18   * and is licensed under the LGPL. For more information please see
  19   * <http://phing.info>.
  20   */
  21  
  22  require_once 'phing/Task.php';
  23  
  24  /**
  25   * Call another target in the same project.
  26   *
  27   *   <pre>
  28   *    <target name="foo">
  29   *      <phingcall target="bar">
  30   *        <property name="property1" value="aaaaa" />
  31   *        <property name="foo" value="baz" />
  32   *       </phingcall>
  33   *    </target>
  34   *
  35   *    <target name="bar" depends="init">
  36   *      <echo message="prop is ${property1} ${foo}" />
  37   *    </target>
  38   *  </pre>
  39   *
  40   * <p>This only works as expected if neither property1 nor foo are
  41   *  defined in the project itself.
  42   *
  43   * @author    Andreas Aderhold <andi@binarycloud.com>
  44   * @copyright 2001,2002 THYRELL. All rights reserved
  45   * @version   $Revision: 1.9 $
  46   * @access    public
  47   * @package   phing.tasks.system
  48   */
  49  class PhingCallTask extends Task {
  50  
  51      private $callee;
  52      private $subTarget;
  53      // must match the default value of PhingTask#inheritAll
  54      private $inheritAll = true;
  55      // must match the default value of PhingTask#inheritRefs
  56      private $inheritRefs = false;
  57  
  58      /**
  59       *  If true, pass all properties to the new Phing project.
  60       *  Defaults to true. Future use.
  61       *  @param boolean new value
  62       */
  63      function setInheritAll($inherit) {
  64          $this->inheritAll = (boolean) $inherit;
  65      }
  66  
  67      /**
  68       *  If true, pass all references to the new Phing project.
  69       *  Defaults to false. Future use.
  70      *
  71       *  @param boolean new value
  72       */
  73      function setInheritRefs($inheritRefs) {
  74          $this->inheritRefs = (boolean) $inheritRefs;
  75      }
  76  
  77      /**
  78       *  init this task by creating new instance of the phing task and
  79       *  configuring it's by calling its own init method.
  80       */
  81      function init() {
  82          $this->callee = $this->project->createTask("phing");
  83          $this->callee->setOwningTarget($this->getOwningTarget());
  84          $this->callee->setTaskName($this->getTaskName());
  85          $this->callee->setLocation($this->getLocation());
  86          $this->callee->init();
  87      }
  88  
  89      /**
  90       *  hand off the work to the phing task of ours, after setting it up
  91       *  @throws BuildException on validation failure or if the target didn't
  92       *  execute
  93       */
  94      function main() {        
  95              
  96          $this->log("Running PhingCallTask for target '" . $this->subTarget . "'", PROJECT_MSG_DEBUG);
  97          if ($this->callee === null) {
  98              $this->init();
  99          }
 100  
 101          if ($this->subTarget === null) {
 102              throw new BuildException("Attribute target is required.", $this->location);
 103          }
 104          
 105          $this->callee->setPhingfile($this->project->getProperty("phing.file"));
 106          $this->callee->setTarget($this->subTarget);
 107          $this->callee->setInheritAll($this->inheritAll);
 108          $this->callee->setInheritRefs($this->inheritRefs);
 109          $this->callee->main();
 110      }
 111  
 112      /**
 113       * Alias for createProperty
 114       * @see createProperty()
 115       */
 116      function createParam() {
 117          if ($this->callee === null) {
 118              $this->init();
 119          }
 120          return $this->callee->createProperty();
 121      }
 122      
 123      /**
 124       * Property to pass to the invoked target.
 125       */
 126      function createProperty() {
 127          if ($this->callee === null) {
 128              $this->init();
 129          }
 130          return $this->callee->createProperty();
 131      }
 132  
 133      /**
 134       * Target to execute, required.
 135       */
 136      function setTarget($target) {
 137          $this->subTarget = (string) $target;
 138      }
 139  }


Généré le : Fri Mar 16 22:42:14 2007 par Balluche grâce à PHPXref 0.7