home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / phing / parser / RootHandler.php < prev    next >
Encoding:
PHP Script  |  2006-09-14  |  3.2 KB  |  83 lines

  1. <?php
  2. /*
  3.  *  $Id: RootHandler.php 123 2006-09-14 20:19:08Z mrook $
  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/parser/AbstractHandler.php';
  23. include_once 'phing/parser/ExpatParseException.php';
  24. include_once 'phing/parser/ProjectHandler.php';
  25.  
  26. /**
  27.  * Root filter class for a phing buildfile.
  28.  *
  29.  * The root filter is called by the parser first. This is where the phing
  30.  * specific parsing starts. RootHandler decides what to do next.
  31.  *
  32.  * @author    Andreas Aderhold <andi@binarycloud.com>
  33.  * @copyright ⌐ 2001,2002 THYRELL. All rights reserved
  34.  * @version   $Revision: 1.7 $
  35.  * @package   phing.parser
  36.  */
  37. class RootHandler extends AbstractHandler {
  38.  
  39.     /**
  40.      * The phing project configurator object
  41.      */
  42.     private $configurator;
  43.  
  44.     /**
  45.      * Constructs a new RootHandler
  46.      *
  47.      * The root filter is required so the parser knows what to do. It's
  48.      * called by the ExpatParser that is instatiated in ProjectConfigurator.
  49.      *
  50.      * It recieves the expat parse object ref and a reference to the
  51.      * configurator
  52.      *
  53.      * @param AbstractSAXParser $parser The ExpatParser object.
  54.      * @param ProjectConfigurator $configurator The ProjectConfigurator object.
  55.      */
  56.     function __construct(AbstractSAXParser $parser, ProjectConfigurator $configurator) {
  57.         $this->configurator = $configurator;
  58.         parent::__construct($parser, $this);
  59.     }
  60.  
  61.     /**
  62.      * Kick off a custom action for a start element tag.
  63.      *
  64.      * The root element of our buildfile is the <project> element. The
  65.      * root filter handles this element if it occurs, creates ProjectHandler 
  66.      * to handle any nested tags & attributes of the <project> tag,
  67.      * and calls init.
  68.      *
  69.      * @param string $tag The xml tagname
  70.      * @param array  $attrs The attributes of the tag
  71.      * @throws ExpatParseException if the first element within our build file
  72.      *         is not the >project< element
  73.      */
  74.     function startElement($tag, $attrs) {
  75.         if ($tag === "project") {
  76.             $ph = new ProjectHandler($this->parser, $this, $this->configurator);
  77.             $ph->init($tag, $attrs);
  78.         } else {
  79.             throw new ExpatParseException("Unexpected tag <$tag> in top-level of build file.", $this->parser->getLocation());
  80.         }
  81.     }
  82. }
  83.