| [ Index ] |
|
Code source de Symfony 1.0.0 |
1 <?php 2 3 /** 4 * $Id: PHPDocumentorTask.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/Task.php'; 24 25 /** 26 * Task to run phpDocumentor. 27 * 28 * @author Michiel Rook <michiel.rook@gmail.com> 29 * @version $Id: PHPDocumentorTask.php 3076 2006-12-18 08:52:12Z fabien $ 30 * @package phing.tasks.ext.phpdoc 31 */ 32 class PHPDocumentorTask extends Task 33 { 34 /** 35 * The path to the executable for phpDocumentor 36 */ 37 private $programPath = 'phpdoc'; 38 39 private $title = "Default Title"; 40 41 private $destdir = "."; 42 43 private $sourcepath = NULL; 44 45 private $output = ""; 46 47 private $linksource = false; 48 49 private $parseprivate = false; 50 51 /** 52 * Sets the path to the phpDocumentor executable 53 */ 54 function setProgramPath($programPath) 55 { 56 $this->programPath = $programPath; 57 } 58 59 /** 60 * Returns the path to the phpDocumentor executable 61 */ 62 function getProgramPath() 63 { 64 return $this->programPath; 65 } 66 67 /** 68 * Set the title for the generated documentation 69 */ 70 function setTitle($title) 71 { 72 $this->title = $title; 73 } 74 75 /** 76 * Set the destination directory for the generated documentation 77 */ 78 function setDestdir($destdir) 79 { 80 $this->destdir = $destdir; 81 } 82 83 /** 84 * Set the source path 85 */ 86 function setSourcepath(Path $sourcepath) 87 { 88 if ($this->sourcepath === NULL) 89 { 90 $this->sourcepath = $sourcepath; 91 } 92 else 93 { 94 $this->sourcepath->append($sourcepath); 95 } 96 } 97 98 /** 99 * Set the output type 100 */ 101 function setOutput($output) 102 { 103 $this->output = $output; 104 } 105 106 /** 107 * Should sources be linked in the generated documentation 108 */ 109 function setLinksource($linksource) 110 { 111 $this->linksource = $linksource; 112 } 113 114 /** 115 * Should private members/classes be documented 116 */ 117 function setParseprivate($parseprivate) 118 { 119 $this->parseprivate = $parseprivate; 120 } 121 122 /** 123 * Main entrypoint of the task 124 */ 125 function main() 126 { 127 $arguments = $this->constructArguments(); 128 129 $this->log("Running phpDocumentor..."); 130 131 exec($this->programPath . " " . $arguments, $output, $return); 132 133 if ($return != 0) 134 { 135 throw new BuildException("Could not execute phpDocumentor: " . implode(' ', $output)); 136 } 137 138 foreach($output as $line) 139 { 140 if(strpos($line, 'ERROR') !== false) 141 { 142 $this->log($line, PROJECT_MSG_ERR); 143 continue; 144 } 145 146 $this->log($line, PROJECT_MSG_VERBOSE); 147 } 148 } 149 150 /** 151 * Constructs an argument string for phpDocumentor 152 */ 153 private function constructArguments() 154 { 155 $arguments = "-q on "; 156 157 if ($this->title) 158 { 159 $arguments.= "-ti \"" . $this->title . "\" "; 160 } 161 162 if ($this->destdir) 163 { 164 $arguments.= "-t \"" . $this->destdir . "\" "; 165 } 166 167 if ($this->sourcepath !== NULL) 168 { 169 $arguments.= "-d \"" . $this->sourcepath->__toString() . "\" "; 170 } 171 172 if ($this->output) 173 { 174 $arguments.= "-o " . $this->output . " "; 175 } 176 177 if ($this->linksource) 178 { 179 $arguments.= "-s on "; 180 } 181 182 if ($this->parseprivate) 183 { 184 $arguments.= "-pp on "; 185 } 186 187 return $arguments; 188 } 189 }; 190 191 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Fri Mar 16 22:42:14 2007 | par Balluche grâce à PHPXref 0.7 |