IntrospectionHelper.php

Show: inherited
Table of Contents

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

Package: phing

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

Propertyprivatearray  $attributeSetters= 'array()'

Holds the attribute setter methods.

string[]
Default valuearray()Details
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 valuearray()Details
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 valuearray()Details
Type
array
Propertyprivatearray  $nestedStorers= 'array()'

Holds methods to store configured nested elements.

string[]
Default valuearray()Details
Type
array
Propertyprivate  $nestedTypes= 'array()'

Map from attribute names to nested types.

Default valuearray()Details
Type
n/a
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 valuearray()Details
Type
array

Methods

methodpublic__construct( string $class ) : void

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 string

The classname for this IH.

methodpublicaddText( \Project $project, string $element, string $text ) : void

Adds PCDATA areas.

Parameters
Name Type Description
$project \Project
$element string
$text string
methodpubliccreateElement( \Project $project, string $element, string $elementName ) : object

Creates a named nested element.

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

Parameters
Name Type Description
$project \Project
$element string
$elementName string
Returns
Type Description
object Returns the nested element.
Throws
Exception Description
\BuildException
methodpublicgetAttributes( ) : \string[]

Return all attribues supported by the introspected class.

Returns
Type Description
\string[]
methodpublicgetElementName( \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 Fully qualified class name of element when possible.
methodpublicgetHelper( string $class ) : void
static

Factory method for helper objects.

Parameters
Name Type Description
$class string

The class to create a Helper for

methodpublicgetNestedElements( ) : \string[]

Return all nested elements supported by the introspected class.

Returns
Type Description
\string[]
methodpublicgetPropertyName( string $methodName, string $prefix ) : string

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

Parameters
Name Type Description
$methodName string
$prefix string
Returns
Type Description
string
methodpublicsetAttribute( \Project $project, string $element, string $attributeName, mixed $value ) : void

Sets the named attribute.

Parameters
Name Type Description
$project \Project
$element string
$attributeName string
$value mixed
methodpublicstoreElement( \Project $project, string $element, string $child, string | null $elementName = null ) : void

Creates a named nested element.

Parameters
Name Type Description
$project \Project
$element string
$child string
$elementName string | null
Throws
Exception Description
\BuildException
methodpublicsupportsCharacters( ) : boolean

Does the introspected class support PCDATA?

Returns
Type Description
boolean
methodpublicwarn( string $msg ) : void

Prints warning message to screen if -debug was used.

Parameters
Name Type Description
$msg string
Documentation was generated by DocBlox 0.18.1.