phing

# Class: Project Source Location: /Project.php
### Class Overview
The Phing project class. Represents a completely configured Phing project. #### Author(s): Hans Lellelid <hans@xmpl.org> Andreas Aderhold <andi@binarycloud.com> #### Version: $Revision: 552 $ | ### Constants MSG_DEBUG MSG_ERR MSG_INFO MSG_VERBOSE MSG_WARN | ### Methods __construct addBuildListener addDataTypeDefinition addOrReplaceTarget addReference addTarget addTaskDefinition copyInheritedProperties copyUserProperties createDataType createTask executeTarget executeTargets fireBuildFinished fireBuildStarted fireMessageLogged fireMessageLoggedEvent fireTargetFinished fireTargetStarted fireTaskFinished fireTaskStarted getBasedir getBuildListeners getDataTypeDefinitions getDefaultTarget getDescription getGlobalFilterSet getInputHandler getName getProperties getProperty getReference getReferences getTargets getTaskDefinitions getUserProperties getUserProperty init log logObject removeBuildListener replaceProperties resolveFile setBasedir setDefaultTarget setDescription setInheritedProperty setInputHandler setName setNewProperty setProperty setSystemProperties setUserProperty _makeCircularException _topoSort _tsort
### Class Details [line 40] The Phing project class. Represents a completely configured Phing project. The class defines the project and all tasks/targets. It also contains methods to start a build as well as some properties and FileSystem abstraction. #### Tags:
author: | Hans Lellelid <hans@xmpl.org>
author: | Andreas Aderhold <andi@binarycloud.com>
version: | $Revision: 552 $
[ Top ] ### Class Methods ### constructor __construct [line 110]
`Project __construct( )`
Constructor, sets any default vars. [ Top ] ### method addBuildListener [line 907]
`void addBuildListener( BuildListener $listener)`
#### Parameters:
BuildListener | $listener |
[ Top ] ### method addDataTypeDefinition [line 540]
`void addDataTypeDefinition( $typeName, $typeClass, [string $classpath = null], string $name, string $class)`
Adds a data type definition. #### Parameters:
string | $name | Name of tag.
string | $class | The class path to use.
string | $classpath | The classpat to use.
| $typeName |
| $typeClass |
[ Top ] ### method addOrReplaceTarget [line 562]
`void addOrReplaceTarget( $targetName, &$target)`
#### Parameters:
| $targetName |
| &$target |
[ Top ] ### method addReference [line 867]
`void addReference( $name, $object)`
Adds a reference to an object. This method is called when the parser detects a id="foo" attribute. It passes the id as $name and a reference to the object assigned to this id as $value #### Parameters:
| $name |
| $object |
[ Top ] ### method addTarget [line 555]
`void addTarget( $targetName, &$target)`
add a new target to the project #### Parameters:
| $targetName |
| &$target |
[ Top ] ### method addTaskDefinition [line 516]
`void addTaskDefinition( string $name, string $class, [string $classpath = null])`
Adds a task definition. #### Parameters:
string | $name | Name of tag.
string | $class | The class path to use.
string | $classpath | The classpat to use.
[ Top ] ### method copyInheritedProperties [line 386]
`void copyInheritedProperties( Project $other)`
Copies all user properties that have not been set on the command line or a GUI tool from this instance to the Project instance given as the argument. To copy all "user" properties, you will also have to call #copyUserProperties. #### Tags:
since: | phing 2.0
access: | public
#### Parameters:
other | $other | the project to copy the properties to. Must not be null.
[ Top ] ### method copyUserProperties [line 365]
`void copyUserProperties( Project $other)`
Copies all user properties that have been set on the command line or a GUI tool from this instance to the Project instance given as the argument. To copy all "user" properties, you will also have to call #copyInheritedProperties. #### Tags:
since: | phing 2.0
access: | public
#### Parameters:
Project | $other | the project to copy the properties to. Must not be null.
[ Top ] ### method createDataType [line 644]
`object A createDataType( string $typeName)`
Create a task instance and return reference to it See createTask() for explanation how this works #### Tags:
return: | datatype object
throws: | BuildException Exception
#### Parameters:
string | $typeName | Type name
[ Top ] ### method createTask [line 593]
`Task createTask( string $taskType)`
Create a new task instance and return reference to it. This method is sorta factory like. A _local_ instance is created and a reference returned to that instance. Usually PHP destroys local variables when the function call ends. But not if you return a reference to that variable. This is kinda error prone, because if no reference exists to the variable it is destroyed just like leaving the local scope with primitive vars. There's no central place where the instance is stored as in other OOP like languages. [HL] Well, ZE2 is here now, and this is still working. We'll leave this alone unless there's any good reason not to. #### Tags:
return: | A task object
throws: | BuildException Exception
#### Parameters:
string | $taskType | Task name
[ Top ] ### method executeTarget [line 698]
`void executeTarget( string $targetName)`
Executes a target #### Tags:
throws: | BuildException
#### Parameters:
string | $targetName | Name of Target to execute
[ Top ] ### method executeTargets [line 685]
`void executeTargets( array $targetNames)`
Executes a list of targets #### Tags:
throws: | BuildException
#### Parameters:
array | $targetNames | List of target names to execute
[ Top ] ### method fireBuildFinished [line 932]
`void fireBuildFinished( $exception)`
#### Parameters:
| $exception |
[ Top ] ### method fireBuildStarted [line 925]
`void fireBuildStarted( )`
[ Top ] ### method fireMessageLogged [line 977]
`void fireMessageLogged( $object, $message, $priority)`
#### Parameters:
| $object |
| $message |
| $priority |
[ Top ] ### method fireMessageLoggedEvent [line 970]
`void fireMessageLoggedEvent( $event, $message, $priority)`
#### Parameters:
| $event |
| $message |
| $priority |
[ Top ] ### method fireTargetFinished [line 947]
`void fireTargetFinished( $target, $exception)`
#### Parameters:
| $target |
| $exception |
[ Top ] ### method fireTargetStarted [line 940]
`void fireTargetStarted( $target)`
#### Parameters:
| $target |
[ Top ] ### method fireTaskFinished [line 962]
`void fireTaskFinished( $task, $exception)`
#### Parameters:
| $task |
| $exception |
[ Top ] ### method fireTaskStarted [line 955]
`void fireTaskStarted( $task)`
#### Parameters:
| $task |
[ Top ] ### method getBasedir [line 474]
`PhingFile getBasedir( )`
Returns the basedir of this project #### Tags:
return: | Basedir PhingFile object
author: | Andreas Aderhold, andi@binarycloud.com
throws: | BuildException
access: | public
[ Top ] ### method getBuildListeners [line 921]
`void getBuildListeners( )`
[ Top ] ### method getDataTypeDefinitions [line 550]
`void getDataTypeDefinitions( )`
[ Top ] ### method getDefaultTarget [line 404]
`void getDefaultTarget( )`
[ Top ] ### method getDescription [line 439]
`void getDescription( )`
return the description, null otherwise [ Top ] ### method getGlobalFilterSet [line 177]
`void getGlobalFilterSet( )`
returns the global filterset (future use) [ Top ] ### method getInputHandler [line 125]
`void getInputHandler( )`
Retrieves the current input handler. #### Tags:
access: | public
[ Top ] ### method getName [line 429]
`string getName( )`
Returns the name of this project #### Tags:
return: | projectname
author: | Andreas Aderhold, andi@binarycloud.com
access: | public
[ Top ] ### method getProperties [line 341]
`array getProperties( )`
Returns a copy of the properties table. #### Tags:
return: | A hashtable containing all properties (including user properties).
access: | public
[ Top ] ### method getProperty [line 287]
`string getProperty( string $name)`
Returns the value of a property, if it is set. #### Tags:
return: | The property value, or null for no match or if a null name is provided.
access: | public
#### Parameters:
string | $name | The name of the property. May be null , in which case the return value is also null .
[ Top ] ### method getReference [line 888]
`Reference getReference( string $key)`
Returns a specific reference. #### Tags:
return: | or null if not defined
#### Parameters:
string | $key | The reference id/key.
[ Top ] ### method getReferences [line 879]
`array getReferences( )`
Returns the references array. [ Top ] ### method getTargets [line 572]
`void getTargets( )`
[ Top ] ### method getTaskDefinitions [line 530]
`void &getTaskDefinitions( )`
[ Top ] ### method getUserProperties [line 349]
`a getUserProperties( )`
Returns a copy of the user property hashtable #### Tags:
return: | hashtable containing just the user properties
access: | public
[ Top ] ### method getUserProperty [line 329]
`string getUserProperty( string $name)`
Returns the value of a user property, if it is set. #### Tags:
return: | The property value, or null for no match or if a null name is provided.
access: | public
#### Parameters:
string | $name | The name of the property. May be null , in which case the return value is also null .
[ Top ] ### method init [line 130]
`void init( )`
inits the project, called from main app [ Top ] ### method log [line 899]
`void log( $msg, [ $level = Project::MSG_INFO])`
Abstracting and simplifyling Logger calls for project messages #### Parameters:
| $msg |
| $level |
[ Top ] ### method logObject [line 903]
`void logObject( $obj, $msg, $level)`
#### Parameters:
| $obj |
| $msg |
| $level |
[ Top ] ### method removeBuildListener [line 911]
`void removeBuildListener( BuildListener $listener)`
#### Parameters:
BuildListener | $listener |
[ Top ] ### method replaceProperties [line 316]
`the replaceProperties( value $value)`
Replaces ${} style constructions in the given value with the string value of the corresponding data types. #### Tags:
return: | given string with embedded property names replaced by values, or null if the given string is null .
exception: | BuildException if the given value has an unclosed property name, e.g. ${xxx
access: | public
#### Parameters:
value | $value | The string to be scanned for property references. May be null .
[ Top ] ### method resolveFile [line 723]
`void resolveFile( $fileName, [ $rootDir = null])`
#### Parameters:
| $fileName |
| $rootDir |
[ Top ] ### method setBasedir [line 444]
`void setBasedir( $dir)`
Set basedir object from xml #### Parameters:
| $dir |
[ Top ] ### method setDefaultTarget [line 400]
`void setDefaultTarget( $targetName)`
#### Parameters:
| $targetName |
[ Top ] ### method setDescription [line 434]
`void setDescription( $description)`
Set the projects description #### Parameters:
| $description |
[ Top ] ### method setInheritedProperty [line 257]
`void setInheritedProperty( string $name, string $value)`
Sets a user property, which cannot be overwritten by set/unset property calls. Any previous value is overwritten. Also marks these properties as properties that have not come from the command line. #### Tags:
see: | #setProperty()
access: | public
#### Parameters:
string | $name | The name of property to set. Must not be null .
string | $value | The new value of the property. Must not be null .
[ Top ] ### method setInputHandler [line 118]
`void setInputHandler( $handler)`
Sets the input handler #### Tags:
access: | public
#### Parameters:
InputHandler | $handler |
[ Top ] ### method setName [line 417]
`void setName( string $name)`
Sets the name of the current project #### Tags:
author: | Andreas Aderhold, andi@binarycloud.com
access: | public
#### Parameters:
string | $name | name of project
[ Top ] ### method setNewProperty [line 221]
`void setNewProperty( string $name, string $value)`
Sets a property if no value currently exists. If the property exists already, a message is logged and the method returns with no other effect. #### Tags:
since: | 2.0
access: | public
#### Parameters:
string | $name | The name of property to set. Must not be null .
string | $value | The new value of the property. Must not be null .
[ Top ] ### method setProperty [line 194]
`void setProperty( string $name, string $value)`
Sets a property. Any existing property of the same name is overwritten, unless it is a user property. #### Tags:
access: | public
#### Parameters:
string | $name | The name of property to set. Must not be null .
string | $value | The new value of the property. Must not be null .
[ Top ] ### method setSystemProperties [line 490]
`void setSystemProperties( )`
Sets system properties and the environment variables for this project. [ Top ] ### method setUserProperty [line 239]
`void setUserProperty( string $name, string $value)`
Sets a user property, which cannot be overwritten by set/unset property calls. Any previous value is overwritten. #### Tags:
see: | #setProperty()
access: | public
#### Parameters:
string | $name | The name of property to set. Must not be null .
string | $value | The new value of the property. Must not be null .
[ Top ] ### method _makeCircularException [line 853]
`void _makeCircularException( $end, $stk)`
#### Parameters:
| $end |
| $stk |
[ Top ] ### method _topoSort [line 740]
`An _topoSort( $root $root, $targets &$targets)`
Topologically sort a set of Targets. #### Tags:
return: | array of Strings with the names of the targets in sorted order.
#### Parameters:
$root | $root | is the (String) name of the root Target. The sort is created in such a way that the sequence of Targets until the root target is the minimum possible such sequence.
$targets | &$targets | is a array representing a "name to Target" mapping
[ Top ] ### method _tsort [line 805]
`void _tsort( $root, &$targets, &$state, &$visiting, &$ret)`
#### Parameters:
| $root |
| &$targets |
| &$state |
| &$visiting |
| &$ret |
[ Top ] ### Class Constants #### MSG_DEBUG = 4 [line 43] [ Top ] #### MSG_ERR = 0 [line 47] [ Top ] #### MSG_INFO = 2 [line 45] [ Top ] #### MSG_VERBOSE = 3 [line 44] [ Top ] #### MSG_WARN = 1 [line 46] [ Top ] Documentation generated on Mon, 19 Oct 2009 10:51:46 +0200 by phpDocumentor 1.4.3