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 andi@binarycloud.com

author

Hans Lellelid hans@xmpl.org

copyright

2001,2002 THYRELL. All rights reserved

version

$Id: 65f8f706a91a2e93636b0f1729954dabb6999f4c $

package

phing

Methods

Factory method for helper objects.

getHelper(string $class) 
static

Arguments

$class

string

The class to create a Helper for

This function constructs a new introspection helper for a specific class.

__construct(string $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.

Arguments

$class

string

The classname for this IH.

Sets the named attribute.

setAttribute(\Project $project, string $element, string $attributeName, mixed $value) 

Arguments

$project

\Project

$element

string

$attributeName

string

$value

mixed

Adds PCDATA areas.

addText(\Project $project, string $element, string $text) 

Arguments

$project

\Project

$element

string

$text

string

Creates a named nested element.

createElement(\Project $project, string $element, string $elementName) : object

Valid creators can be in the form createFoo() or addFoo(Bar).

throws

Arguments

$project

\Project

$element

string

$elementName

string

Response

object

Returns the nested element.

Creates a named nested element.

storeElement(\Project $project, string $element, string $child, string|null $elementName = null) : void
throws

Arguments

$project

\Project

$element

string

$child

string

$elementName

string|null

Does the introspected class support PCDATA?

supportsCharacters() : boolean

Response

boolean

Return all attribues supported by the introspected class.

getAttributes() : string[]

Response

string[]

Return all nested elements supported by the introspected class.

getNestedElements() : string[]

Response

string[]

Get the name for an element.

getElementName(\Project $project, object $element) : string

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.

Arguments

$project

\Project

$element

object

The Task or type element.

Response

string

Fully qualified class name of element when possible.

Extract the name of a property from a method name - subtracting a given prefix.

getPropertyName(string $methodName, string $prefix) : string

Arguments

$methodName

string

$prefix

string

Response

string

Prints warning message to screen if -debug was used.

warn(string $msg) 

Arguments

$msg

string

Properties

Holds the attribute setter methods.

attributeSetters : array
var

string[]

Type(s)

array

Holds methods to create nested elements.

nestedCreators : array
var

string[]

Type(s)

array

Holds methods to store configured nested elements.

nestedStorers : array
var

string[]

Type(s)

array

Map from attribute names to nested types.

nestedTypes : 

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) {}

slotListeners : array
var

string[]

Type(s)

array

The method to add PCDATA stuff.

methodAddText : string
var

Method name of the addText (redundant?) method, if class supports it :)

Type(s)

string

The Class that's been introspected.

bean : object
var
access

private

Type(s)

object

The cache of IntrospectionHelper classes instantiated by getHelper().

helpers : array
static
var

IntrospectionHelpers[]

Type(s)

array