Project.php

Show: inherited
Table of Contents

\Project

Package: phing

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.

Author
Andreas Aderhold  
Author
Hans Lellelid  
Version
$Id: 7e67218e8e616860f9c746f9ab600f523089ea2e $  

Constants

Constant  MSG_DEBUG = 4
Constant  MSG_VERBOSE = 3
Constant  MSG_INFO = 2
Constant  MSG_WARN = 1
Constant  MSG_ERR = 0

Properties

Propertyprivate  $basedir= ''

basedir (PhingFile object)

Details
Type
n/a
Propertyprivate  $defaultTarget= ''all''

the default target name

Default value'all'Details
Type
n/a
Propertyprivate  $description= ''

project description

Details
Type
n/a
Propertyprivate  $fileUtils= ''

a FileUtils object

Details
Type
n/a
Propertyprivate  $globalFilterSet= 'array()'

global filterset (future use)

Default valuearray()Details
Type
n/a
Propertyprivate  $globalFilters= 'array()'

all globals filters (future use)

Default valuearray()Details
Type
n/a
Propertyprivate  $inheritedProperties= 'array()'

Map of inherited "user" properties - that are those "user" properties that have been created by tasks and not been set from the command line or a GUI tool.

Mapping is String to String.

Default valuearray()Details
Type
n/a
Propertyprivate  $inputHandler= ''

The InputHandler being used by this project.

Details
Type
n/a
Propertyprivate  $listeners= 'array()'

Build listeneers

Default valuearray()Details
Type
n/a
Propertyprivate  $name= ''

project name (required)

Details
Type
n/a
Propertyprivate  $phingVersion= ''

require phing version

Details
Type
n/a
Propertyprivate  $properties= 'array()'

Project properties map (usually String to String).

Default valuearray()Details
Type
n/a
Propertyprivate  $references= 'array()'

holds ref names and a reference to the referred object

Default valuearray()Details
Type
n/a
Propertyprivate  $targets= 'array()'

contains the targets

Default valuearray()Details
Type
n/a
Propertyprivate  $taskdefs= 'array()'

task definitions for this project

Default valuearray()Details
Type
n/a
Propertyprivate  $typedefs= 'array()'

type definitions for this project

Default valuearray()Details
Type
n/a
Propertyprivate  $userProperties= 'array()'

Map of "user" properties (as created in the Ant task, for example).

Note that these key/value pairs are also always put into the project properties, so only the project properties need to be queried. Mapping is String to String.

Default valuearray()Details
Type
n/a

Methods

methodpublic__construct( ) : void

Constructor, sets any default vars.

methodpublic_makeCircularException(  $end,  $stk ) : void

Parameters
Name Type Description
$end
$stk
methodpublic_topoSort( string $root, array $targets ) : \An

Topologically sort a set of Targets.

Parameters
Name Type Description
$root string

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 array

is a array representing a "name to Target" mapping

Returns
Type Description
\An array of Strings with the names of the targets in sorted order.
methodpublic_tsort(  $root,  $targets,  $state,  $visiting,  $ret ) : void

Parameters
Name Type Description
$root
$targets
$state
$visiting
$ret
methodpublicaddBuildListener(  $listener ) : void

Parameters
Name Type Description
$listener
methodpublicaddDataTypeDefinition( string $typeName, string $typeClass, string $classpath = null ) : void

Adds a data type definition.

Parameters
Name Type Description
$typeName string

Name of the type.

$typeClass string

The class to use.

$classpath string

The classpath to use.

methodpublicaddOrReplaceTarget( string $targetName, \Target $target ) : void

Adds or replaces a target in the project

Parameters
Name Type Description
$targetName string
$target \Target
methodpublicaddReference( string $name, object $object ) : void

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 Type Description
$name string
$object object
methodpublicaddTarget( string $targetName, \Target $target ) : void

Add a new target to the project

Parameters
Name Type Description
$targetName string
$target \Target
methodpublicaddTaskDefinition( string $name, string $class, string $classpath = null ) : void

Adds a task definition.

Parameters
Name Type Description
$name string

Name of tag.

$class string

The class path to use.

$classpath string

The classpat to use.

methodpubliccopyInheritedProperties( \Project $other ) : void

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 {@link #copyUserProperties copyUserProperties}.

Parameters
Name Type Description
$other \Project

the project to copy the properties to. Must not be null.

Details
Since
phing 2.0  
methodpubliccopyUserProperties( \Project $other ) : void

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 {@link #copyInheritedProperties copyInheritedProperties}.

Parameters
Name Type Description
$other \Project

the project to copy the properties to. Must not be null.

Details
Since
phing 2.0  
methodpubliccreateDataType( string $typeName ) : object

Create a datatype instance and return reference to it See createTask() for explanation how this works

Parameters
Name Type Description
$typeName string

Type name

Returns
Type Description
object A datatype object
Throws
Exception Description
\BuildException Exception
methodpubliccreateTask( string $taskType ) : \Task

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.

Parameters
Name Type Description
$taskType string

Task name

Returns
Type Description
\Task A task object
Throws
Exception Description
\BuildException Exception
methodpublicexecuteTarget( string $targetName ) : void

Executes a target

Parameters
Name Type Description
$targetName string

Name of Target to execute

Throws
Exception Description
\BuildException
methodpublicexecuteTargets( array $targetNames ) : void

Executes a list of targets

Parameters
Name Type Description
$targetNames array

List of target names to execute

Throws
Exception Description
\BuildException
methodpublicfireBuildFinished(  $exception ) : void

Parameters
Name Type Description
$exception
methodpublicfireBuildStarted( ) : void

methodpublicfireMessageLogged(  $object,  $message,  $priority ) : void

Parameters
Name Type Description
$object
$message
$priority
methodpublicfireMessageLoggedEvent(  $event,  $message,  $priority ) : void

Parameters
Name Type Description
$event
$message
$priority
methodpublicfireTargetFinished(  $target,  $exception ) : void

Parameters
Name Type Description
$target
$exception
methodpublicfireTargetStarted(  $target ) : void

Parameters
Name Type Description
$target
methodpublicfireTaskFinished(  $task,  $exception ) : void

Parameters
Name Type Description
$task
$exception
methodpublicfireTaskStarted(  $task ) : void

Parameters
Name Type Description
$task
methodpublicgetBasedir( ) : \PhingFile

Returns the basedir of this project

Returns
Type Description
\PhingFile Basedir PhingFile object
Throws
Exception Description
\BuildException
Details
Access
public  
Author
Andreas Aderhold, andi@binarycloud.com  
methodpublicgetBuildListeners( ) : void

methodpublicgetDataTypeDefinitions( ) : array

Returns the data type definitions

Returns
Type Description
array
methodpublicgetDefaultTarget( ) : string

Returns default target

Returns
Type Description
string
methodpublicgetDescription( ) : string | null

return the description, null otherwise

Returns
Type Description
string | null
methodpublicgetGlobalFilterSet( ) : void

returns the global filterset (future use)

methodpublicgetInputHandler( ) : \InputHandler

Retrieves the current input handler.

Returns
Type Description
\InputHandler
methodpublicgetName( ) : string

Returns the name of this project

Returns
Type Description
string projectname
Details
Access
public  
Author
Andreas Aderhold, andi@binarycloud.com  
methodpublicgetPhingVersion( ) : string

Get the minimum required phing version

Returns
Type Description
string
methodpublicgetProperties( ) : array

Returns a copy of the properties table.

Returns
Type Description
array A hashtable containing all properties (including user properties).
methodpublicgetProperty( string $name ) : string

Returns the value of a property, if it is set.

Parameters
Name Type Description
$name string

The name of the property. May be null, in which case the return value is also null.

Returns
Type Description
string The property value, or <code>null</code> for no match or if a <code>null</code> name is provided.
methodpublicgetReference( string $key ) : object

Returns a specific reference.

Parameters
Name Type Description
$key string

The reference id/key.

Returns
Type Description
object Reference or null if not defined
methodpublicgetReferences( ) : array

Returns the references array.

Returns
Type Description
array
methodpublicgetTargets( ) : array

Returns the available targets

Returns
Type Description
array
methodpublicgetTaskDefinitions( ) : array

Returns the task definitions

Returns
Type Description
array
methodpublicgetUserProperties( ) : \a

Returns a copy of the user property hashtable

Returns
Type Description
\a hashtable containing just the user properties
methodpublicgetUserProperty( string $name ) : string

Returns the value of a user property, if it is set.

Parameters
Name Type Description
$name string

The name of the property. May be null, in which case the return value is also null.

Returns
Type Description
string The property value, or <code>null</code> for no match or if a <code>null</code> name is provided.
methodpublicinit( ) : void

inits the project, called from main app

methodpubliclog( string $msg, int $level = Project::MSG_INFO ) : void

Abstracting and simplifyling Logger calls for project messages

Parameters
Name Type Description
$msg string
$level int
methodpubliclogObject(  $obj,  $msg,  $level ) : void

Parameters
Name Type Description
$obj
$msg
$level
methodpublicremoveBuildListener(  $listener ) : void

Parameters
Name Type Description
$listener
methodpublicreplaceProperties( \value $value ) : \the

Replaces ${} style constructions in the given value with the string value of the corresponding data types.

Parameters
Name Type Description
$value \value

The string to be scanned for property references. May be null.

Returns
Type Description
\the given string with embedded property names replaced by values, or <code>null</code> if the given string is <code>null</code>.
Details
Exception
BuildException if the given value has an unclosed property name, e.g. ${xxx  
methodpublicresolveFile(  $fileName,  $rootDir = null ) : void

Helper function

Parameters
Name Type Description
$fileName
$rootDir
methodpublicsetBasedir( \PhingFile | string $dir ) : void

Set basedir object from xm

Parameters
Name Type Description
$dir \PhingFile | string
methodpublicsetDefaultTarget( string $targetName ) : void

Sets default target

Parameters
Name Type Description
$targetName string
methodpublicsetDescription( string $description ) : void

Set the projects description

Parameters
Name Type Description
$description string
methodpublicsetInheritedProperty( string $name, string $value ) : void

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.

Parameters
Name Type Description
$name string

The name of property to set. Must not be null.

$value string

The new value of the property. Must not be null.

Details
See
\#setProperty()  
methodpublicsetInputHandler( \InputHandler $handler ) : void

Sets the input handler

Parameters
Name Type Description
$handler \InputHandler
methodpublicsetName( string $name ) : void

Sets the name of the current project

Parameters
Name Type Description
$name string

name of project

Details
Access
public  
Author
Andreas Aderhold, andi@binarycloud.com  
methodpublicsetNewProperty( string $name, string $value ) : void

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.

Parameters
Name Type Description
$name string

The name of property to set. Must not be null.

$value string

The new value of the property. Must not be null.

Details
Since
2.0  
methodpublicsetPhingVersion( string $version ) : void

Set the minimum required phing version

Parameters
Name Type Description
$version string
methodpublicsetProperty( string $name, string $value ) : void

Sets a property. Any existing property of the same name is overwritten, unless it is a user property.

Parameters
Name Type Description
$name string

The name of property to set. Must not be null.

$value string

The new value of the property. Must not be null.

methodprivatesetPropertyInternal( \name $name, \value $value ) : void

Sets a property unless it is already defined as a user property (in which case the method returns silently).

Parameters
Name Type Description
$name \name

The name of the property. Must not be null.

$value \value

The property value. Must not be null.

methodpublicsetSystemProperties( ) : void

Sets system properties and the environment variables for this project.

methodpublicsetUserProperty( string $name, string $value ) : void

Sets a user property, which cannot be overwritten by set/unset property calls. Any previous value is overwritten.

Parameters
Name Type Description
$name string

The name of property to set. Must not be null.

$value string

The new value of the property. Must not be null.

Details
See
\#setProperty()  
Documentation was generated by DocBlox 0.18.1.