Source for file Writer.class.php

Documentation is available at Writer.class.php

  1. <?php
  2. /**
  3.  * Gumbo Library Framework
  4.  *
  5.  * LICENSE
  6.  * This library is being released under the terms of the New BSD License.  A
  7.  * copy of the license is packaged with the software (LICENSE.txt).  If no
  8.  * copy is found, a copy of the license template can be found at:
  9.  * http://www.opensource.org/licenses/bsd-license.php
  10.  * 
  11.  * @category Gumbo
  12.  * @package Config
  13.  * @copyright Copyright (c) 2007, iBayou, Michael Luster
  14.  * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
  15.  * @author Michael Luster <mluster79@yahoo.com>
  16.  * @link http://sourceforge.net/projects/phpgumbo
  17.  * @version 0.0.1
  18.  */
  19.  
  20. /**
  21.  * Config Writer Interface
  22.  * 
  23.  * A Config Writer will take a Composite object and write the details into
  24.  * a file.  The Writer will define the particular formatting of the file.
  25.  * 
  26.  * A Config Writer performs the opposite operation of a Config Reader.  It will
  27.  * accept a Composite object, a file to write to, and whether the original file
  28.  * should be replaced (if found).  The rules are the same as the Config Reader, where
  29.  * the type of file being written is determined by the class name.
  30.  * 
  31.  * In order to apply a Config Writer to Library, simply create a new class inside
  32.  * the '/gumbo/config/writer/*' directory.  The class name should be defined as
  33.  * 'Gumbo_Config_Writer_[type]' where 'type' is the type of configuration file
  34.  * it will be responsible for writing.  For example, supplied with the Library
  35.  * is a Gumbo_Config_Writer_Ini class.  This class will write INI files.
  36.  * 
  37.  * The data must be in the form of a Composite.  Refer to the Composite Package
  38.  * for more details.
  39.  *
  40.  * @category Gumbo
  41.  * @package Config
  42.  * @copyright Copyright (c) 2007, iBayou, Michael Luster
  43.  * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
  44.  * @author Michael Luster <mluster79@yahoo.com>
  45.  * @link http://sourceforge.net/projects/phpgumbo
  46.  * @desc Config Writer Interface
  47.  * @version 0.0.1
  48.  */
  49.  
  50. gumbo_load ("Interface_Composite");
  51.  
  52.     
  53.     /** ACTION METHODS **/
  54.     /**
  55.      * Writes the supplied values into the configuration file
  56.      * @param Gumbo_Interface_Composite $tree data to write
  57.      * @param string $file file to write (full path)
  58.      * @param bool $replace if replaces file (if found)
  59.      * @return bool if successful
  60.      */
  61.     public function write (Gumbo_Interface_Composite $tree$file$replace=true);
  62.     
  63. }
  64.  
  65. ?>