XML_SaxFilters
[ class tree: XML_SaxFilters ] [ index: XML_SaxFilters ] [ all elements ]

Source for file ListWriter.php

Documentation is available at ListWriter.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. //
  4. // +----------------------------------------------------------------------+
  5. // | PHP Version 4                                                        |
  6. // +----------------------------------------------------------------------+
  7. // | Copyright (c) 1997-2002 The PHP Group                                |
  8. // +----------------------------------------------------------------------+
  9. // | This source file is subject to version 2.02 of the PHP license,      |
  10. // | that is bundled with this package in the file LICENSE, and is        |
  11. // | available at through the world-wide-web at                           |
  12. // | http://www.php.net/license/2_02.txt.                                 |
  13. // | If you did not receive a copy of the PHP license and are unable to   |
  14. // | obtain it through the world-wide-web, please send a note to          |
  15. // | license@php.net so we can mail you a copy immediately.               |
  16. // +----------------------------------------------------------------------+
  17. // | Authors: Luis Argerich <lrargerich@yahoo.com> Original Author        |
  18. // | Authors: Harry Fuecks <hfuecks@phppatterns.com> Port to PEAR + more  |
  19. // +----------------------------------------------------------------------+
  20. //
  21. // $Id: StructWriter.php,v 1.6 2003/09/12 11:15:15 harryf Exp $
  22. //
  23. /**
  24. * Required classes
  25. */
  26. if (!defined('XML_SAXFILTERS')) {
  27.     define('XML_SAXFILTERS''XML/');
  28. }
  29. require_once(XML_SAXFILTERS.'SaxFilters/IO/ListReader.php');
  30. /**
  31.  * ListWriter writes variables to a list
  32.  * @access public
  33.  * @package XML_SaxFilters
  34.  */
  35. class XML_SaxFilters_IO_ListWriter /* implements XML_SaxFilters_IO_WriterInterface */
  36. {
  37.     /**
  38.      * List to write to
  39.      * @var array 
  40.      * @access private
  41.      */
  42.     var $list;
  43.  
  44.     /**
  45.      * ListWriter Constructor
  46.      * @access public
  47.      */
  48.     function XML_SaxFilters_IO_ListWriter()
  49.     {
  50.         $this->list = array();
  51.     }
  52.  
  53.     /**
  54.      * Adds elemment to the list (it won't allow you to write values which
  55.      * evaluate to false)
  56.      * @param mixed data to write
  57.      * @access public
  58.      * @return boolean TRUE on success, FALSE is you try to write a FALSE value
  59.      */
  60.     function write($data)
  61.     {
  62.         if $data {
  63.             $this->list[]=$data;
  64.             return TRUE;
  65.         else {
  66.             return FALSE;
  67.         }
  68.     }
  69.  
  70.     /**
  71.      * Returns a ListReader
  72.      * @access public
  73.      * @return XML_SaxFilters_IO_ListReader 
  74.      */
  75.     function getReader()
  76.     {
  77.         return new XML_SaxFilters_IO_ListReader($this->list);
  78.     }
  79.  
  80.     /**
  81.      * "Close" the list - does nothing
  82.      * @access public
  83.      * @return boolean 
  84.      */
  85.     function close()
  86.     {
  87.         return TRUE;
  88.     }
  89. }
  90. ?>

Documentation generated on Mon, 11 Mar 2019 10:15:10 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.