Changeset 377
- Timestamp:
- 06/27/08 16:02:16 (3 months ago)
- Files:
-
- branches/2.3/classes/phing/types/Path.php (modified) (24 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/2.3/classes/phing/types/Path.php
r359 r377 17 17 * This software consists of voluntary contributions made by many individuals 18 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 19 * <http://phing.info>. 20 20 */ 21 21 … … 38 38 * to provide a way for this class to add paths to the include path, if desired -- or to create 39 39 * an IncludePath subclass. Once added, though, when would a path be removed from the include path? 40 * 40 * 41 41 * <p> 42 42 * <code> … … 66 66 class Path extends DataType { 67 67 68 private $elements = array(); 69 68 private $elements = array(); 69 70 70 /** 71 71 * Constructor for internally instantiated objects sets project. … … 79 79 if ($path !== null) { 80 80 $this->createPathElement()->setPath($path); 81 } 81 } 82 82 } 83 83 … … 91 91 if ($this->isReference()) { 92 92 throw $this->tooManyAttributes(); 93 } 93 } 94 94 $this->createPathElement()->setDir($location); 95 95 } … … 124 124 /** 125 125 * Creates the nested <code><pathelement></code> element. 126 * @throws BuildException 126 * @throws BuildException 127 127 */ 128 128 public function createPathElement() { … … 137 137 /** 138 138 * Adds a nested <code><fileset></code> element. 139 * @throws BuildException 139 * @throws BuildException 140 140 */ 141 141 public function addFileset(FileSet $fs) { … … 149 149 /** 150 150 * Adds a nested <code><dirset></code> element. 151 * @throws BuildException 151 * @throws BuildException 152 152 */ 153 153 public function addDirset(DirSet $dset) { … … 207 207 $this->setDir($f); 208 208 } else { 209 $this->log("dropping " . $f->__toString() . " from path as it doesn't exist", 209 $this->log("dropping " . $f->__toString() . " from path as it doesn't exist", 210 210 Project::MSG_VERBOSE); 211 211 } … … 236 236 } 237 237 } 238 238 239 239 if (is_string($o)) { 240 240 $result[] = $o; … … 242 242 $parts = $o->getParts(); 243 243 if ($parts === null) { 244 throw new BuildException("You must either set location or" 244 throw new BuildException("You must either set location or" 245 245 . " path on <pathelement>"); 246 246 } … … 266 266 $result[] = $d->getAbsolutePath(); 267 267 } 268 var_dump($result);269 268 } elseif ($o instanceof FileList) { 270 269 $fl = $o; … … 277 276 } 278 277 } 279 278 280 279 return array_unique($result); 281 280 } … … 288 287 */ 289 288 public function __toString() { 290 289 291 290 $list = $this->listPaths(); 292 291 … … 295 294 return ""; 296 295 } 297 296 298 297 return implode(PATH_SEPARATOR, $list); 299 298 } … … 325 324 } 326 325 } 327 326 328 327 return $result; 329 328 } … … 331 330 /** 332 331 * Returns its argument with all file separator characters 333 * replaced so that they match the local OS conventions. 332 * replaced so that they match the local OS conventions. 334 333 */ 335 334 public static function translateFile($source) { … … 342 341 self::translateFileSep($result, $i); 343 342 } 344 343 345 344 return $result; 346 345 } … … 349 348 * Translates all occurrences of / or \ to correct separator of the 350 349 * current platform and returns whether it had to do any 351 * replacements. 350 * replacements. 352 351 */ 353 352 protected static function translateFileSep(&$buffer, $pos) { … … 380 379 /** 381 380 * Overrides the version of DataType to recurse on all DataType 382 * child elements that may have been added. 381 * child elements that may have been added. 383 382 * @throws BuildException 384 383 */ … … 388 387 return; 389 388 } 390 389 391 390 // elements can contain strings, FileSets, Reference, etc. 392 391 foreach($this->elements as $o) { 393 392 394 393 if ($o instanceof Reference) { 395 394 $o = $o->getReferencedObject($p); … … 406 405 } 407 406 } 408 407 409 408 $this->checked = true; 410 409 } … … 422 421 return $relativeName; 423 422 } 424 423 425 424 } 426 425 … … 433 432 private $parts = array(); 434 433 private $outer; 435 434 436 435 public function __construct(Path $outer) { 437 436 $this->outer = $outer; 438 437 } 439 438 440 439 public function setDir(PhingFile $loc) { 441 440 $this->parts = array(Path::translateFile($loc->getAbsolutePath()));
