[ 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/ -> AdhocTypedefTask.php (source)

   1  <?php
   2  
   3  /*
   4   * $Id: AdhocTypedefTask.php 3076 2006-12-18 08:52:12Z fabien $
   5   *
   6   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   7   * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   8   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   9   * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  10   * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  11   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  12   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  13   * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  14   * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  15   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  16   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  17   *
  18   * This software consists of voluntary contributions made by many individuals
  19   * and is licensed under the LGPL. For more information please see
  20   * <http://phing.info>.
  21   */
  22   
  23  require_once 'phing/tasks/system/AdhocTask.php';
  24  
  25  /**
  26   * A class for creating adhoc datatypes in build file.
  27   * 
  28   * @author    Hans Lellelid <hans@xmpl.org>
  29   * @version   $Revision: 1.4 $
  30   * @package   phing.tasks.system
  31   */
  32  class AdhocTypedefTask extends AdhocTask {
  33  
  34      /**
  35       * The tag that refers to this task.
  36       */
  37      private $name;
  38  
  39      /**
  40       * Set the tag that will represent this adhoc task/type.
  41       * @param string $name
  42       */       
  43      public function setName($name) {
  44          $this->name = $name;
  45      }
  46          
  47      /** Main entry point */
  48      public function main() {
  49      
  50          if ($this->name === null) {
  51              throw new BuildException("The name attribute is required for adhoc task definition.",$this->location);
  52          }
  53          
  54          $this->execute();
  55          
  56          $classes = $this->getNewClasses();
  57          if (count($classes) !== 1) {
  58              throw new BuildException("You must define one (and only one) class for AdhocTypedefTask.");
  59          }
  60          $classname = array_shift($classes);
  61          
  62          // instantiate it to make sure it is an instance of ProjectComponent
  63          $t = new $classname();
  64          if (!($t instanceof ProjectComponent)) {
  65              throw new BuildException("The adhoc class you defined must be an instance of phing.ProjectComponent", $this->location);
  66          }
  67          
  68          $this->log("Datatype " . $this->name . " will be handled by class " . $classname, PROJECT_MSG_VERBOSE);
  69          $this->project->addDataTypeDefinition($this->name, $classname);        
  70      }
  71  }


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