IntrospectionHelper.php
Helper class that collects the methods that a task or nested element holds to set attributes, create nested elements or hold PCDATA elements.
- SMART-UP INLINE DOCS
- POLISH-UP THIS CLASS
- Author
- Andreas Aderhold
- Author
- Hans Lellelid
- Copyright
- 2001,2002 THYRELL. All rights reserved
- Package
- phing
- Version
- $Id: a5f2dbd71bafd2c363026d911132c3b47bf44239 $
\IntrospectionHelper
Helper class that collects the methods that a task or nested element holds to set attributes, create nested elements or hold PCDATA elements.
- SMART-UP INLINE DOCS
- POLISH-UP THIS CLASS
- Author
- Andreas Aderhold
- Author
- Hans Lellelid
- Copyright
- 2001,2002 THYRELL. All rights reserved
- Version
- $Id: a5f2dbd71bafd2c363026d911132c3b47bf44239 $
Properties

array
$attributeSetters= 'array()'
Holds the attribute setter methods.
string[]array()Details- Type
- array

array
$helpers= 'array()'
The cache of IntrospectionHelper classes instantiated by getHelper().
IntrospectionHelpers[]array()Details- Type
- array

string
$methodAddText= 'null'
The method to add PCDATA stuff.
Method name of the addText (redundant?) method, if class supports it :)nullDetails- Type
- string

array
$nestedCreators= 'array()'
Holds methods to create nested elements.
string[]array()Details- Type
- array

array
$nestedStorers= 'array()'
Holds methods to store configured nested elements.
string[]array()Details- Type
- array

$nestedTypes= 'array()'
Map from attribute names to nested types.
array()Details- Type
- n/a

array
$slotListeners= 'array()'
New idea in phing: any class can register certain keys -- e.g. "task.current_file" -- which can be used in task attributes, if supported. In the build XML these are referred to like this: <regexp pattern="\n" replace="%{task.current_file}"/> In the type/task a listener method must be defined: function setListeningReplace($slot) {}
string[]array()Details- Type
- array
Methods

__construct(
string $class
)
:
voidThis function constructs a new introspection helper for a specific class.
This method loads all methods for the specified class and categorizes them as setters, creators, slot listeners, etc. This way, the setAttribue() doesn't need to perform any introspection -- either the requested attribute setter/creator exists or it does not & a BuildException is thrown.
| Name | Type | Description |
|---|---|---|
| $class | string | The classname for this IH. |

addText(
\Project $project, string $element, string $text
)
:
voidAdds PCDATA areas.
| Name | Type | Description |
|---|---|---|
| $project | \Project | |
| $element | string | |
| $text | string |

createElement(
\Project $project, string $element, string $elementName
)
:
objectCreates a named nested element.
Valid creators can be in the form createFoo() or addFoo(Bar).
| Name | Type | Description |
|---|---|---|
| $project | \Project | |
| $element | string | |
| $elementName | string |
| Type | Description |
|---|---|
| object | Returns the nested element. |
| Exception | Description |
|---|---|
| \BuildException |

getAttributes(
)
:
\string[]Return all attribues supported by the introspected class.
| Type | Description |
|---|---|
| \string[] |

getElementName(
\Project $project, object $element
)
:
stringGet the the name for an element.
When possible the full classnam (phing.tasks.system.PropertyTask) will be returned. If not available (loaded in taskdefs or typedefs) then the XML element name will be returned.
| Name | Type | Description |
|---|---|---|
| $project | \Project | |
| $element | object | The Task or type element. |
| Type | Description |
|---|---|
| string | Fully qualified class name of element when possible. |

getHelper(
string $class
)
:
voidFactory method for helper objects.
| Name | Type | Description |
|---|---|---|
| $class | string | The class to create a Helper for |

getNestedElements(
)
:
\string[]Return all nested elements supported by the introspected class.
| Type | Description |
|---|---|
| \string[] |

getPropertyName(
string $methodName, string $prefix
)
:
stringExtract the name of a property from a method name - subtracting a given prefix.
| Name | Type | Description |
|---|---|---|
| $methodName | string | |
| $prefix | string |
| Type | Description |
|---|---|
| string |

setAttribute(
\Project $project, string $element, string $attributeName, mixed $value
)
:
voidSets the named attribute.
| Name | Type | Description |
|---|---|---|
| $project | \Project | |
| $element | string | |
| $attributeName | string | |
| $value | mixed |

storeElement(
\Project $project, string $element, string $child, string | null $elementName
=
null
)
:
voidCreates a named nested element.
| Name | Type | Description |
|---|---|---|
| $project | \Project | |
| $element | string | |
| $child | string | |
| $elementName | string | null |
| Exception | Description |
|---|---|
| \BuildException |

supportsCharacters(
)
:
booleanDoes the introspected class support PCDATA?
| Type | Description |
|---|---|
| boolean |