[ Index ]
 

Code source de Symfony 1.0.0

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

title

Body

[fermer]

/lib/vendor/phing/filters/ -> ExpandProperties.php (source)

   1  <?php
   2  
   3  /*
   4   *  $Id: ExpandProperties.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/filters/BaseFilterReader.php';
  24  include_once 'phing/filters/ChainableReader.php';
  25  
  26  /**
  27   * Expands Phing Properties, if any, in the data.
  28   * <p>
  29   * Example:<br>
  30   * <pre><expandproperties/></pre>
  31   * Or:
  32   * <pre><filterreader classname="phing.filters.ExpandProperties'/></pre>
  33   *
  34   * @author    Yannick Lecaillez <yl@seasonfive.com>
  35   * @author    Hans Lellelid <hans@xmpl.org>
  36   * @version   $Revision: 1.6 $
  37   * @see       BaseFilterReader
  38   * @package   phing.filters
  39   */
  40  class ExpandProperties extends BaseFilterReader implements ChainableReader {
  41     
  42      /**
  43       * Returns the filtered stream. 
  44       * The original stream is first read in fully, and the Phing properties are expanded.
  45       * 
  46       * @return mixed     the filtered stream, or -1 if the end of the resulting stream has been reached.
  47       * 
  48       * @exception IOException if the underlying stream throws an IOException
  49       * during reading
  50       */
  51      function read($len = null) {
  52                  
  53          $buffer = $this->in->read($len);
  54          
  55          if($buffer === -1) {
  56              return -1;
  57          }
  58          
  59          $project = $this->getProject();
  60          $buffer = ProjectConfigurator::replaceProperties($project, $buffer, $project->getProperties());
  61          
  62          return $buffer;
  63      }
  64          
  65      /**
  66       * Creates a new ExpandProperties filter using the passed in
  67       * Reader for instantiation.
  68       * 
  69       * @param object A Reader object providing the underlying stream.
  70       *               Must not be <code>null</code>.
  71       * 
  72       * @return object A new filter based on this configuration, but filtering
  73       *         the specified reader
  74       */
  75      function chain(Reader $reader) {
  76          $newFilter = new ExpandProperties($reader);
  77          $newFilter->setProject($this->getProject());
  78          return $newFilter;
  79      }
  80  }
  81  
  82  ?>


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