phing-types

# Class: Path Source Location: /types/Path.php
### Class Overview
    ProjectComponent
       |
       --DataType
          |
          --Path
This object represents a path as used by include_path or PATH environment variable. #### Author(s): Hans Lellelid <hans@xmpl.org> (Phing) Thomas.Haas@softwired-inc.com (Ant) Stefan Bodewig <stefan.bodewig@epost.de> (Ant) #### Version: $Revision: 526 $ | ### Methods __construct addDirset addExisting addFileset append createPath createPathElement dieOnCircularReference listPaths setDir setPath setRefid size translateFile translateFileSep translatePath __clone __toString
### Inherited Variables #### Class: DataType DataType::$checked DataType::$description DataType::$ref #### Class: ProjectComponent ProjectComponent::$project | ### Inherited Methods #### Class: DataType DataType::circularReference() Creates an exception that indicates the user has generated a loop of data types referencing each other. DataType::dieOnCircularReference() Check to see whether any DataType we hold references to is included in the Stack (which holds all DataType instances that directly or indirectly reference this instance, including this instance itself). DataType::getCheckedRef() Performs the check for circular references and returns the referenced object. DataType::getDescription() Return the description for the current data type. DataType::isReference() Has the refid attribute of this element been set? DataType::noChildrenAllowed() Creates an exception that indicates that this XML element must not have child elements if the refid attribute is set. DataType::parsingComplete() Template method being called when the data type has been parsed completely. DataType::setDescription() Sets a description of the current data type. It will be useful in commenting what we are doing. DataType::setRefid() Set the value of the refid attribute. DataType::tooManyAttributes() Creates an exception that indicates that refid has to be the only attribute if it is set. #### Class: ProjectComponent ProjectComponent::getProject() Returns a reference to current project ProjectComponent::log() Logs a message with the given priority. ProjectComponent::setProject() References the project to the current component.
### Class Details [line 66] This object represents a path as used by include_path or PATH environment variable. This class has been adopted from the Java Ant equivalent. The ability have path structures in Phing is important; however, because of how PHP classes interact the ability to specify CLASSPATHs makes less sense than Java.Rather than providing CLASSPATH for any tasks that take classes as parameters, perhaps a better solution in PHP is to have an IncludePath task, which prepends paths to PHP's include_path INI variable. This gets around the problem that simply using a path to load the initial PHP class is not enough (in most cases the loaded class may assume that it is on the global PHP include_path, and will try to load dependent classes accordingly). The other option is to provide a way for this class to add paths to the include path, if desired -- or to create an IncludePath subclass. Once added, though, when would a path be removed from the include path? <p> &lt; sometask&gt;<br> &nbsp;&nbsp;&lt; somepath&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&lt; pathelement location="/path/to/file" /&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&lt; pathelement path="/path/to/class2;/path/to/class3" /&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&lt; pathelement location="/path/to/file3" /&gt;<br> &nbsp;&nbsp;&lt;/somepath&gt;<br> &lt;/sometask&gt;<br> <p> The object implemention sometask must provide a method called createSomepath which returns an instance of Path . Nested path definitions are handled by the Path object and must be labeled pathelement .<p> The path element takes a parameter path which will be parsed and split into single elements. It will usually be used to define a path from an environment variable. #### Tags:
author: | Hans Lellelid <hans@xmpl.org> (Phing)
author: | Thomas.Haas@softwired-inc.com (Ant)
author: | Stefan Bodewig <stefan.bodewig@epost.de> (Ant)
version: | $Revision: 526 $
[ Top ] ### Class Methods ### static method translateFile [line 334]
`static void translateFile( $source)`
Returns its argument with all file separator characters replaced so that they match the local OS conventions. #### Tags:
access: | public
#### Parameters:
| $source |
[ Top ] ### static method translateFileSep [line 352]
`static void translateFileSep( &$buffer, $pos)`
Translates all occurrences of / or \ to correct separator of the current platform and returns whether it had to do any replacements. #### Tags:
access: | protected
#### Parameters:
| &$buffer |
| $pos |
[ Top ] ### static method translatePath [line 305]
`static void translatePath( $project, string $source)`
Splits a PATH (with : or ; as separators) into its parts. #### Tags:
access: | public
#### Parameters:
Project | $project |
string | $source |
[ Top ] ### constructor __construct [line 75]
`Path __construct( [Project $project = null], [string $path = null])`
Constructor for internally instantiated objects sets project. #### Tags:
access: | public
#### Parameters:
Project | $project |
string | $path | (for use by IntrospectionHelper)
[ Top ] ### method addDirset [line 153]
`void addDirset( DirSet $dset)`
Adds a nested &lt; dirset&gt; element. #### Tags:
throws: | BuildException
access: | public
#### Parameters:
DirSet | $dset |
[ Top ] ### method addExisting [line 196]
`void addExisting( Path $source)`
Adds the components on the given path which exist to this Path. Components that don't exist, aren't added. #### Tags:
access: | public
#### Parameters:
Path | $source | - Source path whose components are examined for existence.
[ Top ] ### method addFileset [line 141]
`void addFileset( FileSet $fs)`
Adds a nested &lt; fileset&gt; element. #### Tags:
throws: | BuildException
access: | public
#### Parameters:
FileSet | $fs |
[ Top ] ### method append [line 178]
`void append( Path $other)`
Append the contents of the other Path instance to this. #### Tags:
access: | public
#### Parameters:
Path | $other |
[ Top ] ### method createPath [line 165]
`void createPath( )`
Creates a nested &lt; path&gt; element. #### Tags:
throws: | BuildException
access: | public
[ Top ] ### method createPathElement [line 128]
`void createPathElement( )`
Creates the nested &lt; pathelement&gt; element. #### Tags:
throws: | BuildException
access: | public
[ Top ] ### method dieOnCircularReference [line 384]
`void dieOnCircularReference( &$stk, $p)`
Overrides the version of DataType to recurse on all DataType child elements that may have been added. #### Tags:
throws: | BuildException
access: | public
Overrides DataType::dieOnCircularReference() (Check to see whether any DataType we hold references to is included in the Stack (which holds all DataType instances that directly or indirectly reference this instance, including this instance itself).) #### Parameters:
| &$stk |
Project | $p |
[ Top ] ### method listPaths [line 219]
`array listPaths( )`
Returns all path elements defined by this and nested path objects. #### Tags:
return: | List of path elements.
access: | public
[ Top ] ### method setDir [line 90]
`void setDir( $location)`
Adds a element definition to the path. #### Tags:
throws: | BuildException
access: | public
#### Parameters:
$location | $location | the location of the element to add (must not be null nor empty.
[ Top ] ### method setPath [line 102]
`void setPath( path $path)`
Parses a path definition and creates single PathElements. #### Tags:
throws: | BuildException
access: | public
#### Parameters:
path | $path | the path definition.
[ Top ] ### method setRefid [line 116]
`void setRefid( Reference $r)`
Makes this instance in effect a reference to another Path instance. You must not set another attribute or nest elements inside this element if you make it a reference. #### Tags:
throws: | BuildException
access: | public
Overrides DataType::setRefid() (Set the value of the refid attribute.) #### Parameters:
Reference | $r |
[ Top ] ### method size [line 366]
`int size( )`
How many parts does this Path instance consist of. DEV NOTE: expensive call! list is generated, counted, and then discareded. #### Tags:
access: | public
[ Top ] ### method __clone [line 373]
`void __clone( )`
Return a Path that holds the same elements as this instance. #### Tags:
access: | public
[ Top ] ### method __toString [line 288]
`string __toString( )`
Returns a textual representation of the path, which can be used as CLASSPATH or PATH environment variable definition. #### Tags:
return: | A textual representation of the path.
access: | public
[ Top ] Documentation generated on Mon, 19 Oct 2009 10:51:22 +0200 by phpDocumentor 1.4.3