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 / tasks / ext / phpdoc / PhingPhpDocumentorSetup.php next >
Encoding:
PHP Script  |  2007-10-17  |  6.2 KB  |  176 lines

  1. <?php
  2. /**
  3.  * $Id: PHPDocumentorTask.php 144 2007-02-05 15:19:00Z hans $
  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. /**
  23.  * Phing subclass of the phpDocumentor_setup class provided with PhpDocumentor to work around limitations in PhpDocumentor API.
  24.  * 
  25.  * This class is necessary because phpDocumentor_setup does not expose a complete API for setting configuration options.  Because
  26.  * this class must directly modify some "private" GLOBAL(!) configuration variables, it is liable to break if the PhpDocumentor
  27.  * internal implementation changes.  Obviously this is far from ideal, but there's also no solution given the inflexibility of the
  28.  * PhpDocumentor design. 
  29.  * 
  30.  * @author Hans Lellelid <hans@xmpl.org>@author hans
  31.  * @version $Id$
  32.  * @package phing.tasks.ext.phpdoc
  33.  */
  34. class PhingPhpDocumentorSetup extends phpDocumentor_setup {
  35.     
  36.     /**
  37.      * Constructs a new PhingPhpDocumentorSetup.
  38.      *
  39.      * @param string $configDir Directory in which to look for configuration files.
  40.      */
  41.     public function __construct($configdir = null) {
  42.         global $_phpDocumentor_cvsphpfile_exts, $_phpDocumentor_setting;
  43.         
  44.         $this->setup = new Io();
  45.         $this->render = new phpDocumentor_IntermediateParser("Default Title");
  46.         
  47.         $GLOBALS['_phpDocumentor_install_dir'] = $configdir;
  48.         $this->parseIni();
  49.         
  50.         if (tokenizer_ext) {
  51.             $this->parse = new phpDocumentorTParser();
  52.         } else {
  53.             $this->parse = new Parser();
  54.         }
  55.     }
  56.     
  57.     /**
  58.      * Set whether to generate sourcecode for each file parsed.
  59.      *
  60.      * This method exists as a hack because there is no API exposed for this in PhpDocumentor.
  61.      * Note that because we are setting a "private" GLOBAL(!!) config var with this value, this
  62.      * is subject to break if PhpDocumentor internals changes.  
  63.      * 
  64.      * @param bool $b
  65.      */
  66.     public function setGenerateSourcecode($b) {
  67.         global $_phpDocumentor_setting;
  68.         $_phpDocumentor_setting['sourcecode'] = (boolean) $b;
  69.     }
  70.     
  71.     /**
  72.      * Set an array of README/INSTALL/CHANGELOG file paths. 
  73.      *
  74.      * This method exists as a hack because there is no API exposed for this in PhpDocumentor.
  75.      * Note that because we are setting a "private" GLOBAL(!!) config var with this value, this
  76.      * is subject to break if PhpDocumentor internals changes.  
  77.      * 
  78.      * @param array $files Absolute paths to files.
  79.      */
  80.     public function setRicFiles($files) {
  81.         global $_phpDocumentor_RIC_files;
  82.         $_phpDocumentor_RIC_files = $files;
  83.     }
  84.     
  85.     /**
  86.      * Set comma-separated list of tags to ignore.
  87.      *
  88.      * This method exists as a hack because there is no API exposed for this in PhpDocumentor.
  89.      * Note that because we are setting a "private" GLOBAL(!!) config var with this value, this
  90.      * is subject to break if PhpDocumentor internals changes.  
  91.      * 
  92.      * @param string $tags
  93.      */
  94.     public function setIgnoreTags($tags) {
  95.         global $_phpDocumentor_setting; 
  96.         $ignoretags = explode(',', $tags);
  97.         $ignoretags = array_map('trim', $ignoretags);
  98.         $tags = array();
  99.         foreach($ignoretags as $tag) {
  100.             if (!in_array($tag,array('@global', '@access', '@package', '@ignore', '@name', '@param', '@return', '@staticvar', '@var')))
  101.                 $tags[] = $tag;
  102.         }
  103.         $_phpDocumentor_setting['ignoretags'] = $tags;
  104.     }
  105.     
  106.     /**
  107.      * Set whether to parse dirs as PEAR repos. 
  108.      *
  109.      * This method exists as a hack because there is no API exposed for this in PhpDocumentor.
  110.      * Note that because we are setting a "private" GLOBAL(!!) config var with this value, this
  111.      * is subject to break if PhpDocumentor internals changes.  
  112.      * 
  113.      * @param bool $b
  114.      */
  115.     public function setPear($b) {
  116.         global $_phpDocumentor_setting;
  117.         $_phpDocumentor_setting['pear'] = (boolean) $b;
  118.     }
  119.     
  120.     /**
  121.      * Set fullpath to directory to look in for examples. 
  122.      *
  123.      * This method exists as a hack because there is no API exposed for this in PhpDocumentor.
  124.      * Note that because we are setting a "private" GLOBAL(!!) config var with this value, this
  125.      * is subject to break if PhpDocumentor internals changes.  
  126.      * 
  127.      * @param string $dir
  128.      */
  129.     public function setExamplesDir($dir) {
  130.         global $_phpDocumentor_setting;
  131.         $_phpDocumentor_setting['examplesdir'] = $dir;
  132.     }
  133.     
  134.     /**
  135.      * Sets the default package name.
  136.      *
  137.      * This method exists as a hack because there is no API exposed for this in PhpDocumentor.
  138.      * Note that because we are setting a "private" GLOBAL(!!) config var with this value, this
  139.      * is subject to break if PhpDocumentor internals changes.  
  140.      * 
  141.      * @param string $name
  142.      */
  143.     public function setDefaultPackageName($name) {
  144.         $GLOBALS['phpDocumentor_DefaultPackageName'] = trim($name);
  145.     }
  146.     
  147.     /**
  148.      * Sets the default category name.
  149.      *
  150.      * This method exists as a hack because there is no API exposed for this in PhpDocumentor.
  151.      * Note that because we are setting a "private" GLOBAL(!!) config var with this value, this
  152.      * is subject to break if PhpDocumentor internals changes.  
  153.      * 
  154.      * @param string $name
  155.      */
  156.     public function setDefaultCategoryName($name) {
  157.         $GLOBALS['phpDocumentor_DefaultCategoryName'] = trim($name);
  158.     }
  159.     
  160.     /**
  161.      * Enables quiet mode.
  162.      *
  163.      * This method exists as a hack because the API exposed for this method in PhpDocumentor
  164.      * doesn't work correctly.
  165.      * 
  166.      * Note that because we are setting a "private" GLOBAL(!!) config var with this value, this
  167.      * is subject to break if PhpDocumentor internals changes.  
  168.      * 
  169.      */
  170.     public function setQuietMode() {
  171.         global $_phpDocumentor_setting;
  172.         $_phpDocumentor_setting['quiet'] = true;
  173.         parent::setQuietMode();
  174.     }
  175.     
  176. }