classes/phing/IntrospectionHelper.php

\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
package
phing
version
$Revision: 930 $

Properties

Propertyprivatearray  $attributeSetters= 'array'

Holds the attribute setter methods.

string[]
Default valuearrayDetails
Type
array
Propertyprivateobject  $bean= ''

The Class that's been introspected.

Details
Type
object
access
private
Propertyprivatearray  $helpers= 'array'
static

The cache of IntrospectionHelper classes instantiated by getHelper().

IntrospectionHelpers[]
Default valuearrayDetails
Type
array
Propertyprivatestring  $methodAddText= 'null'

The method to add PCDATA stuff.

Method name of the addText (redundant?) method, if class supports it :)
Default valuenullDetails
Type
string
Propertyprivatearray  $nestedCreators= 'array'

Holds methods to create nested elements.

string[]
Default valuearrayDetails
Type
array
Propertyprivatearray  $nestedStorers= 'array'

Holds methods to store configured nested elements.

string[]
Default valuearrayDetails
Type
array
Propertyprivate  $nestedTypes= 'array'

Map from attribute names to nested types.

Default valuearrayDetails
Type
Propertyprivatearray  $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[]
Default valuearrayDetails
Type
array

Methods

methodpublic  __construct(  $class ) :
This 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.

Parameters
Name Type Description
$class
methodpublic  addText(  $project,  $element,  $text ) :
Adds PCDATA areas.
Parameters
Name Type Description
$project
$element
$text
methodpublic  createElement(  $project,  $element,  $elementName ) : object
Creates a named nested element.

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

Parameters
Name Type Description
$project
$element
$elementName
Returns
Type Description
object
Details
throws
methodpublic  getAttributes( ) :
Return all attribues supported by the introspected class.
methodpublic  getElementName( \Project $project, object $element ) : string
Get 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.

Parameters
Name Type Description
$project \Project
$element object The Task or type element.
Returns
Type Description
string
methodpublic  getHelper( string $class ) :
staticFactory method for helper objects.
Parameters
Name Type Description
$class string The class to create a Helper for
methodpublic  getNestedElements( ) :
Return all nested elements supported by the introspected class.
methodpublic  getPropertyName(  $methodName,  $prefix ) :
extract the name of a property from a method name - subtracting a given prefix.
Parameters
Name Type Description
$methodName
$prefix
methodpublic  setAttribute(  $project,  $element,  $attributeName,  $value ) :
Sets the named attribute.
Parameters
Name Type Description
$project
$element
$attributeName
$value
methodpublic  storeElement(  $project,  $element,  $child,  $elementName = null ) : void
Creates a named nested element.
Parameters
Name Type Description
$project
$element
$child
$elementName
Details
throws
methodpublic  supportsCharacters( ) :
Does the introspected class support PCDATA?
methodpublic  warn(  $msg ) :
Prints warning message to screen if -debug was used.
Parameters
Name Type Description
$msg
Documentation was generated by DocBlox 0.13.1.