tasks/system/AdhocTaskdefTask.php
A class for creating adhoc tasks in build file.
class FooTest extends Task {
private $bar;
function setBar($bar) {
$this->bar = $bar;
}
function main() {
$this->log("In FooTest: " . $this->bar);
}
}
]]></adhoc-task>
<foo bar="B.L.I.N.G"/>
- Author
- Hans Lellelid
- Package
- phing.tasks.system
- Version
- $Id$
\AdhocTaskdefTask
A class for creating adhoc tasks in build file.
class FooTest extends Task {
private $bar;
function setBar($bar) {
$this->bar = $bar;
}
function main() {
$this->log("In FooTest: " . $this->bar);
}
}
]]></adhoc-task>
<foo bar="B.L.I.N.G"/>
- Parent(s)
- \AdhocTask < \Task < \ProjectComponent
- Author
- Hans Lellelid
- Copyright
- 2001,2002 THYRELL. All rights reserved
- Version
- $Id$
Properties

string
$description= ''
- Type
- string
- Inherited_from
- \Task::$$description
- Inherited_from
- \AdhocTask::$$description

\Location
$location= ''
- Type
- \Location
- Inherited_from
- \Task::$$location
- Inherited_from
- \AdhocTask::$$location

$newClasses= 'array()'
array()Details- Type
- n/a
- Inherited_from
- \AdhocTask::$$newClasses

\Project
$project= 'null'
Holds a reference to the project that a project component (a task, a target, etc.) belongs to
A reference to the current project instanceInherited from: \ProjectComponent::$$project\Task::$$project\AdhocTask::$$projectnullDetails- Type
- \Project
- Inherited_from
- \ProjectComponent::$$project
- Inherited_from
- \Task::$$project
- Inherited_from
- \AdhocTask::$$project

\Target
$target= ''
- Type
- \Target
- Inherited_from
- \Task::$$target
- Inherited_from
- \AdhocTask::$$target

string
$taskName= ''
- Type
- string
- Inherited_from
- \Task::$$taskName
- Inherited_from
- \AdhocTask::$$taskName

string
$taskType= ''
- Type
- string
- Inherited_from
- \Task::$$taskType
- Inherited_from
- \AdhocTask::$$taskType

\RuntimeConfigurable
$wrapper= ''
- Type
- \RuntimeConfigurable
- Inherited_from
- \Task::$$wrapper
- Inherited_from
- \AdhocTask::$$wrapper
Methods

execute(
)
:
stringLoad the adhoc class, and perform any core validation.
Inherited from: \AdhocTask::execute()| Type | Description |
|---|---|
| string | The classname of the ProjectComponent class. |
| Exception | Description |
|---|---|
| \BuildException | - if more than one class is defined. |

getDescription(
)
:
stringReturns the textual description of the task
Inherited from: \Task::getDescription()\AdhocTask::getDescription()| Type | Description |
|---|---|
| string | The text description of the task |

getLocation(
)
:
\LocationReturns the location within the buildfile this task occurs. Used by {@link BuildException} to give detailed error messages.
Inherited from: \Task::getLocation()\AdhocTask::getLocation()| Type | Description |
|---|---|
| \Location | The location object describing the position of this task within the buildfile. |

getOwningTarget(
)
:
\TargetReturns the owning target of this task.
Inherited from: \Task::getOwningTarget()\AdhocTask::getOwningTarget()| Type | Description |
|---|---|
| \Target | The target object that owns this task |

getProject(
)
:
\ProjectReturns a reference to current project
Inherited from: \ProjectComponent::getProject()\Task::getProject()\AdhocTask::getProject()| Type | Description |
|---|---|
| \Project | Reference to current porject object |

getRuntimeConfigurableWrapper(
)
:
\RuntimeConfigurableReturns the wrapper object for runtime configuration
Inherited from: \Task::getRuntimeConfigurableWrapper()\AdhocTask::getRuntimeConfigurableWrapper()| Type | Description |
|---|---|
| \RuntimeConfigurable | The wrapper object used by this task |

getTaskName(
)
:
stringReturns the name of task, used only for log messages
Inherited from: \Task::getTaskName()\AdhocTask::getTaskName()| Type | Description |
|---|---|
| string | Name of this task |

getTaskType(
)
:
stringReturns the name of the task under which it was invoked, usually the XML tagname
Inherited from: \Task::getTaskType()\AdhocTask::getTaskType()| Type | Description |
|---|---|
| string | The type of this task (XML Tag) |

init(
)
:
voidCalled by the parser to let the task initialize properly.
Inherited from: \Task::init()\AdhocTask::init()Should throw a BuildException if something goes wrong with the build
This is abstract here, but may not be overloaded by subclasses.
| Exception | Description |
|---|---|
| \BuildException |

log(
string $msg, integer $level
=
Project::MSG_INFO
)
:
voidProvides a project level log event to the task.
Inherited from: \Task::log()\AdhocTask::log()| Name | Type | Description |
|---|---|---|
| $msg | string | The message to log |
| $level | integer | The priority of the message |
- See
- \BuildEvent
- See
- \BuildListener

main(
)
:
voidMain entry point
Should throw a BuildException if someting goes wrong with the build
This is abstract here. Must be overloaded by real tasks.

maybeConfigure(
)
:
voidConfigure this task if it hasn't been done already.
Inherited from: \Task::maybeConfigure()\AdhocTask::maybeConfigure()
setDescription(
string $desc
)
:
voidSets a textual description of the task
Inherited from: \Task::setDescription()\AdhocTask::setDescription()| Name | Type | Description |
|---|---|---|
| $desc | string | The text describing the task |

setLocation(
\Location $location
)
:
voidSets the location within the buildfile this task occurs. Called by the parser to set location information.
Inherited from: \Task::setLocation()\AdhocTask::setLocation()| Name | Type | Description |
|---|---|---|
| $location | \Location | The location object describing the position of this task within the buildfile. |

setName(
string $name
)
:
voidSet the tag that will represent this adhoc task/type.
| Name | Type | Description |
|---|---|---|
| $name | string |

setOwningTarget(
\Target $target
)
:
voidSets the owning target this task belongs to.
Inherited from: \Task::setOwningTarget()\AdhocTask::setOwningTarget()| Name | Type | Description |
|---|---|---|
| $target | \Target | Reference to owning target |

setProject(
\Project $project
)
:
voidReferences the project to the current component.
Inherited from: \ProjectComponent::setProject()\Task::setProject()\AdhocTask::setProject()| Name | Type | Description |
|---|---|---|
| $project | \Project | The reference to the current project |

setRuntimeConfigurableWrapper(
\RuntimeConfigurable $wrapper
)
:
voidSets the wrapper object this task should use for runtime configurable elements.
Inherited from: \Task::setRuntimeConfigurableWrapper()\AdhocTask::setRuntimeConfigurableWrapper()| Name | Type | Description |
|---|---|---|
| $wrapper | \RuntimeConfigurable | The wrapper object this task should use |

setTaskName(
string $name
)
:
stringSets the name of this task for log messages
Inherited from: \Task::setTaskName()\AdhocTask::setTaskName()| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| string | A string representing the name of this task for log |

setTaskType(
string $name
)
:
voidSets the type of the task. Usually this is the name of the XML tag
Inherited from: \Task::setTaskType()\AdhocTask::setTaskType()| Name | Type | Description |
|---|---|---|
| $name | string | The type of this task (XML Tag) |