Entry point into Phing. This class handles the full lifecycle of a build -- from
parsing & handling commandline arguments to assembling the project to shutting down
and cleaning up in the end.



__import(
string $path, mixed $classpath
=
null
)
:
staticImport a PHP file
Parameters
| Name |
Type |
Description |
| $path |
string |
Path to the PHP file |
| $classpath |
mixed |
String or object supporting __toString()
|
Details
- throws
- - if cannot find the specified file



_findBuildFile(
string $start, string $suffix
)
:
\PhingFileSearch parent directories for the build file.
Takes the given target as a suffix to append to each
parent directory in search of a build file. Once the
root of the file-system has been reached an exception
is thrown.
Parameters
| Name |
Type |
Description |
| $start |
string |
Start file path. |
| $suffix |
string |
Suffix filename to look for in parents. |
Returns
| Type |
Description |
| \PhingFile |
|
Details
- throws
- Failed to locate a build file



_getParentFile(
\PhingFile $file
)
:
\PhingFileHelper to get the parent file for a given file.
Parameters
| Name |
Type |
Description |
| $file |
\PhingFile |
|
Returns
| Type |
Description |
| \PhingFile |
|



_printTargets(
array $names, array $descriptions, string $heading, int $maxlen
)
:
Writes a formatted list of target names with an optional description.
Parameters
| Name |
Type |
Description |
| $names |
array |
The names to be printed. Must not be null.
|
| $descriptions |
array |
The associated target descriptions. May be null, in which case no descriptions are displayed. If non-null, this should have as many elements as names.
|
| $heading |
string |
The heading to display. Should not be null.
|
| $maxlen |
int |
The maximum length of the names of the targets. If descriptions are given, they are padded to this position so they line up (so long as the names really are shorter than this).
|



addBuildListeners(
\Project $project
)
:
voidBind any registered build listeners to this project.
This means adding the logger and any build listeners that were specified
with -listener arg.
Parameters
| Name |
Type |
Description |
| $project |
\Project |
|



addInputHandler(
\Project $project
)
:
Creates the InputHandler and adds it to the project.
Parameters
| Name |
Type |
Description |
| $project |
\Project |
the project instance. |
Details
- throws
- if a specified InputHandler class could not be loaded.



convertShorthand(
string $val
)
:
staticConverts shorthand notation values as returned by ini_get()
Parameters
| Name |
Type |
Description |
| $val |
string |
|
Details
- see
- \http://www.php.net/ini_get



currentTimeMillis(
)
:
static



execute(
array $args
)
:
voidSetup/initialize Phing environment from commandline args.
Parameters
| Name |
Type |
Description |
| $args |
array |
commandline args passed to phing shell. |



fire(
array $args
)
:
void
staticCommand line entry point. This method kicks off the building
of a project object and executes a build using either a given
target or the default target.
Parameters
| Name |
Type |
Description |
| $args |
array |
Command line args. |



getCurrentProject(
)
:
\Project
staticGets the current Project.
Returns
| Type |
Description |
| \Project |
|



getDefinedProperty(
string $name
)
:
string
staticThis gets a property that was set via command line or otherwise passed into Phing.
"Defined" in this case means "externally defined". The reason this method exists is to
provide a public means of accessing commandline properties for (e.g.) logger or listener
scripts. E.g. to specify which logfile to use, PearLogger needs to be able to access
the pear.log.name property.
Parameters
| Name |
Type |
Description |
| $name |
string |
|
Returns



getErrorStream(
)
:
\OutputStream
staticGets the stream to use for error output.
Returns
| Type |
Description |
| \OutputStream |
|



getOutputStream(
)
:
\OutputStream
staticGets the stream to use for standard (non-error) output.
Returns
| Type |
Description |
| \OutputStream |
|



getPhingVersion(
)
:
string
staticGets the current Phing version based on VERSION.TXT file.
Returns
Details
- throws
- - if unable to find version file.



getProperty(
$propName
)
:
string
staticReturns property value for a System property.
System properties are "global" properties like application.startdir,
and user.dir. Many of these correspond to similar properties in Java
or Ant.
Parameters
| Name |
Type |
Description |
| $propName |
|
|
Returns



getResourcePath(
$path
)
:
string
staticLooks on include path for specified file.
Parameters
| Name |
Type |
Description |
| $path |
|
|
Returns



halt(
)
:
staticHalts the system.
Details
- deprecated
- This method is deprecated and is no longer called by Phing internally. Any
normal shutdown routines are handled by the shutdown() method.
- see
- \shutdown()



handleLogfile(
)
:
staticClose logfiles, if we have been writing to them.
Details
- since
- Phing 2.3.0



handlePhpError(
$level, $message, $file, $line
)
:
staticError handler for PHP errors encountered during the build.
This uses the logging for the currently configured project.
Parameters
| Name |
Type |
Description |
| $level |
|
|
| $message |
|
|
| $file |
|
|
| $line |
|
|



import(
string $dotPath, mixed $classpath
=
null
)
:
string
staticImport a dot-path notation class path.
Parameters
| Name |
Type |
Description |
| $dotPath |
string |
|
| $classpath |
mixed |
String or object supporting __toString()
|
Returns
Details
- throws
- - if cannot find the specified file



log(
string $message, int $priority
=
Project
)
:
staticA static convenience method to send a log to the current (last-setup) Project.
If there is no currently-configured Project, then this will do nothing.
Parameters
| Name |
Type |
Description |
| $message |
string |
|
| $priority |
int |
Project::MSG_INFO, etc. |



printDescription(
$project
)
:
staticPrint the project description, if any
Parameters
| Name |
Type |
Description |
| $project |
|
|



printTargets(
$project
)
:
Print out a list of all targets in the current buildfile
Parameters
| Name |
Type |
Description |
| $project |
|
|



restoreIni(
)
:
void
staticRestores [most] PHP INI values to their pre-Phing state.
Currently the following settings are not restored:
- max_execution_time (because getting current time limit is not possible)
- memory_limit (which may have been increased by Phing)



setCurrentProject(
\Project $p
)
:
staticSets the current Project
Parameters
| Name |
Type |
Description |
| $p |
\Project |
|



setDefinedProperty(
string $name, $value
)
:
string
staticThis sets a property that was set via command line or otherwise passed into Phing.
Parameters
| Name |
Type |
Description |
| $name |
string |
|
| $value |
|
|
Returns



setErrorStream(
\OutputStream $stream
)
:
staticSets the stream to use for error output.
Parameters
| Name |
Type |
Description |
| $stream |
\OutputStream |
The stream to use for error output. |



setIncludePaths(
)
:
void
staticSets the include path to PHP_CLASSPATH constant (if this has been defined).
Details
- throws
- - if the include_path could not be set (for some bizarre reason)



setOutputStream(
\OutputStream $stream
)
:
staticSets the stream to use for standard (non-error) output.
Parameters
| Name |
Type |
Description |
| $stream |
\OutputStream |
The stream to use for standard output. |



start(
array $args, array $additionalUserProperties
=
null
)
:
staticEntry point allowing for more options from other front ends.
This method encapsulates the complete build lifecycle.
Parameters
| Name |
Type |
Description |
| $args |
array |
The commandline args passed to phing shell script. |
| $additionalUserProperties |
array |
Any additional properties to be passed to Phing (alternative front-end might implement this). These additional properties will be available using the getDefinedProperty() method and will be added to the project's "user" properties
|
Details
- see
- \execute()
- see
- \runBuild()
- throws
- - if there is an error during build



startPhpErrorCapture(
)
:
staticBegins capturing PHP errors to a buffer.
While errors are being captured, they are not logged.



startup(
)
:
void
staticStart up Phing.
Sets up the Phing environment but does not initiate the build process.
Details
- throws
- - If the Phing environment cannot be initialized.



stopPhpErrorCapture(
)
:
staticStops capturing PHP errors to a buffer.
The errors will once again be logged after calling this method.