1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
|
<?php
/**
* $Id: cde99d501839daf8c9dd9df61ee6cce7caad6b3e $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information please see
* <http://phing.info>.
*/
require_once 'PhpDocumentor/phpDocumentor/Setup.inc.php';
/**
* Phing subclass of the phpDocumentor_setup class provided with PhpDocumentor to work around limitations in PhpDocumentor API.
*
* This class is necessary because phpDocumentor_setup does not expose a complete API for setting configuration options. Because
* this class must directly modify some "private" GLOBAL(!) configuration variables, it is liable to break if the PhpDocumentor
* internal implementation changes. Obviously this is far from ideal, but there's also no solution given the inflexibility of the
* PhpDocumentor design.
*
* @author Hans Lellelid <hans@xmpl.org>@author hans
* @version $Id: cde99d501839daf8c9dd9df61ee6cce7caad6b3e $
* @package phing.tasks.ext.phpdoc
*/
class PhingPhpDocumentorSetup extends phpDocumentor_setup {
/**
* Constructs a new PhingPhpDocumentorSetup.
*
* @param string $configDir Directory in which to look for configuration files.
* @param object $task The task we're working with, so we can pass it on to the ErrorTracker
*/
public function __construct($configdir = null, $task) {
global $_phpDocumentor_cvsphpfile_exts, $_phpDocumentor_setting, $_phpDocumentor_phpfile_exts;
$this->setup = new Io();
$this->render = new phpDocumentor_IntermediateParser("Default Title");
$GLOBALS['_phpDocumentor_install_dir'] = $configdir;
$this->parseIni();
// These redundant-looking lines seem to actually make a difference.
// See: http://phing.info/trac/ticket/150
$_phpDocumentor_phpfile_exts = $GLOBALS['_phpDocumentor_phpfile_exts'];
$_phpDocumentor_cvsphpfile_exts = $GLOBALS['_phpDocumentor_cvsphpfile_exts'];
if (tokenizer_ext) {
$this->parse = new phpDocumentorTParser();
} else {
$this->parse = new Parser();
}
$this->setMemoryLimit();
include_once 'phing/tasks/ext/phpdoc/PhingPhpDocumentorErrorTracker.php';
// Inject our own error tracker to PhpDocumentor
$GLOBALS['phpDocumentor_errors'] = new PhingPhpDocumentorErrorTracker;
$GLOBALS['phpDocumentor_errors']->setTask($task);
}
/**
* Set whether to generate sourcecode for each file parsed.
*
* This method exists as a hack because there is no API exposed for this in PhpDocumentor.
* Note that because we are setting a "private" GLOBAL(!!) config var with this value, this
* is subject to break if PhpDocumentor internals changes.
*
* @param bool $b
*/
public function setGenerateSourcecode($b) {
global $_phpDocumentor_setting;
$_phpDocumentor_setting['sourcecode'] = (boolean) $b;
}
/**
* Set an array of README/INSTALL/CHANGELOG file paths.
*
* This method exists as a hack because there is no API exposed for this in PhpDocumentor.
* Note that because we are setting a "private" GLOBAL(!!) config var with this value, this
* is subject to break if PhpDocumentor internals changes.
*
* @param array $files Absolute paths to files.
*/
public function setRicFiles($files) {
global $_phpDocumentor_RIC_files;
$_phpDocumentor_RIC_files = $files;
}
/**
* Set comma-separated list of tags to ignore.
*
* This method exists as a hack because there is no API exposed for this in PhpDocumentor.
* Note that because we are setting a "private" GLOBAL(!!) config var with this value, this
* is subject to break if PhpDocumentor internals changes.
*
* @param string $tags
*/
public function setIgnoreTags($tags) {
global $_phpDocumentor_setting;
$ignoretags = explode(',', $tags);
$ignoretags = array_map('trim', $ignoretags);
$tags = array();
foreach($ignoretags as $tag) {
if (!in_array($tag,array('@global', '@access', '@package', '@ignore', '@name', '@param', '@return', '@staticvar', '@var')))
$tags[] = $tag;
}
$_phpDocumentor_setting['ignoretags'] = $tags;
}
/**
* Set whether to parse dirs as PEAR repos.
*
* This method exists as a hack because there is no API exposed for this in PhpDocumentor.
* Note that because we are setting a "private" GLOBAL(!!) config var with this value, this
* is subject to break if PhpDocumentor internals changes.
*
* @param bool $b
*/
public function setPear($b) {
global $_phpDocumentor_setting;
$_phpDocumentor_setting['pear'] = (boolean) $b;
}
/**
* Set fullpath to directory to look in for examples.
*
* This method exists as a hack because there is no API exposed for this in PhpDocumentor.
* Note that because we are setting a "private" GLOBAL(!!) config var with this value, this
* is subject to break if PhpDocumentor internals changes.
*
* @param string $dir
*/
public function setExamplesDir($dir) {
global $_phpDocumentor_setting;
$_phpDocumentor_setting['examplesdir'] = $dir;
}
/**
* Sets the default package name.
*
* This method exists as a hack because there is no API exposed for this in PhpDocumentor.
* Note that because we are setting a "private" GLOBAL(!!) config var with this value, this
* is subject to break if PhpDocumentor internals changes.
*
* @param string $name
*/
public function setDefaultPackageName($name) {
$GLOBALS['phpDocumentor_DefaultPackageName'] = trim($name);
}
/**
* Sets the default category name.
*
* This method exists as a hack because there is no API exposed for this in PhpDocumentor.
* Note that because we are setting a "private" GLOBAL(!!) config var with this value, this
* is subject to break if PhpDocumentor internals changes.
*
* @param string $name
*/
public function setDefaultCategoryName($name) {
$GLOBALS['phpDocumentor_DefaultCategoryName'] = trim($name);
}
/**
* Enables quiet mode.
*
* This method exists as a hack because the API exposed for this method in PhpDocumentor
* doesn't work correctly.
*
* Note that because we are setting a "private" GLOBAL(!!) config var with this value, this
* is subject to break if PhpDocumentor internals changes.
*
*/
public function setQuietMode() {
global $_phpDocumentor_setting;
$_phpDocumentor_setting['quiet'] = true;
parent::setQuietMode();
}
/**
* Control whether or not warnings will be shown for undocumented elements.
* Useful for identifying classes and methods that haven't yet been
* documented.
*
* @param bool $bEnable
*/
public function setUndocumentedelements($bEnable) {
$this->render->setUndocumentedElementWarningsMode($bEnable);
}
/**
* custom tags, will be recognized and put in tags[] instead of
* unknowntags[]
*
* This method exists as a hack because the API exposed for this method in
* PhpDocumentor doesn't work correctly.
*
* Note that because we are setting a "private" GLOBAL(!!) config var with
* this value, this is subject to break if PhpDocumentor internals changes.
*
* @param string $sCustomtags
*/
public function setCustomtags($sCustomtags) {
global $_phpDocumentor_setting;
$_phpDocumentor_setting['customtags'] = $sCustomtags;
}
/**
* Files to ignore
*
* @param string $sIgnore
*/
public function setIgnore($sIgnore) {
global $_phpDocumentor_setting;
$_phpDocumentor_setting['ignore'] = $sIgnore;
}
}
|