# tasks/system/PropertyTask.php

## \PropertyTask
jump to top

Package: phing\tasks\system

Task for setting properties in buildfiles.

Parent(s)
  \Task < \ProjectComponent
Children
  \XmlPropertyTask
Author
  Andreas Aderhold
Author
  Hans Lellelid
Version
  $Revision: 552 $

### Properties

`$env= ''`
Details

Type
  n/a

`$fallback= ''`
Details

Type
  n/a

`$file= ''`
Details

Type
  n/a

`$name= ''`

name of the property

Details

Type
  n/a

`$override= 'false'`

Whether to force overwrite of existing property.

Default value `false` Details

Type
  n/a

`$prefix= ''`
Details

Type
  n/a

`$ref= ''`
Details

Type
  n/a

`$reference= ''`
Details

Type
  n/a

`$userProperty= 'false'`

Whether property should be treated as "user" property.

Default value `false` Details

Type
  n/a

`$value= ''`

value of the property

Details

Type
  n/a

### Methods

`addProperties( $props ) : void`

iterate through a set of properties, resolve them then assign them

Parameters

Name | Type | Description
--- | --- | ---
$props |  |

`addProperty( string $name, string $value ) : void`

add a name value pair to the project property set

Parameters

Name | Type | Description
--- | --- | ---
$name | string | name of property
$value | string | value to set

`addText( $value ) : void`

Sets value of property to CDATA tag contents.

Parameters

Name | Type | Description
--- | --- | ---
$value |  |

Details

Since
  2.2.0

`getDescription( ) : void`

`getEnvironment( ) : void`

`getFallback( ) : void`

`getFile( ) : void`

Get the PhingFile that is being used as property source.

`getLocation( ) : void`

`getName( ) : void`

Get property component name.

`getOverride( ) : void`

`getOwningTarget( ) : void`

`getPrefix( ) : string`

Returns

Type | Description
--- | ---
string |

Details

Since
  2.0

`getProject( ) : void`

`getRefid( ) : void`

`getRegisterSlot( ) : void`

`getRuntimeConfigurableWrapper( ) : void`

`getTaskName( ) : void`

`getTaskType( ) : void`

`getUserProperty( ) : void`

`getValue( ) : void`

Get the value of current property component.

`init( ) : void`

`loadEnvironment( string $prefix ) : void`

load the environment values

Parameters

Name | Type | Description
--- | --- | ---
$prefix | string | prefix to place before them

`loadFile( \PhingFile $file ) : void`

load properties from a file.

Parameters

Name | Type | Description
--- | --- | ---
$file | \PhingFile |

`log( ) : void`

`main( ) : void`

set the property in the project to the value.

if the task was give a file or env attribute here is where it is loaded

`maybeConfigure( ) : void`

`parsePropertyString( string $value, array $fragments, array $propertyRefs ) : void`

This method will parse a string containing ${value} style property values into two lists. The first list is a collection of text fragments, while the other is a set of string property names null entries in the first list indicate a property reference from the second list.

This is slower than regex, but useful for this class, which has to handle multiple parsing passes for properties.

Parameters

Name | Type | Description
--- | --- | ---
$value | string | The string to be scanned for property references
$fragments | array | &$fragments The found fragments
$propertyRefs | array | &$propertyRefs The found refs

`perform( ) : void`

`resolveAllProperties( \Properties $props ) : void`

Given a Properties object, this method goes through and resolves any references to properties within the object.

Parameters

Name | Type | Description
--- | --- | ---
$props | \Properties | The collection of Properties that need to be resolved.

`setDescription( ) : void`

`setEnvironment( \env $env ) : void`

the prefix to use when retrieving environment variables.

Thus if you specify environment="myenv" you will be able to access OS-specific environment variables via property names "myenv.PATH" or "myenv.TERM".

<

p> Note that if you supply a property name with a final "." it will not be doubled. ie environment="myenv." will still allow access of environment variables through "myenv.PATH" and "myenv.TERM". This functionality is currently only implemented on select platforms. Feel free to send patches to increase the number of platforms this functionality is supported on ;).
Note also that properties are case sensitive, even if the environment variables on your operating system are not, e.g. it will be ${env.Path} not ${env.PATH} on Windows 2000.

Parameters

Name | Type | Description
--- | --- | ---
$env | \env | prefix

`setFallback( \Project $p ) : void`

Parameters

Name | Type | Description
--- | --- | ---
$p | \Project |

`setFile( $file ) : void`

Set a file to use as the source for properties.

Parameters

Name | Type | Description
--- | --- | ---
$file |  |

`setLocation( ) : void`

`setName( $name ) : void`

Sets a the name of current property component

Parameters

Name | Type | Description
--- | --- | ---
$name |  |

`setOverride( $v ) : void`

Parameters

Name | Type | Description
--- | --- | ---
$v |  |

`setOwningTarget( ) : void`

`setPrefix( string $prefix ) : void`

Prefix to apply to properties loaded using `file`.

A "." is appended to the prefix if not specified.

Parameters

Name | Type | Description
--- | --- | ---
$prefix | string | prefix string

Details

Since
  2.0

`setProject( ) : void`

`setRefid( $ref ) : void`

Parameters

Name | Type | Description
--- | --- | ---
$ref |  |

`setRuntimeConfigurableWrapper( ) : void`

`setTaskName( ) : void`

`setTaskType( ) : void`

`setUserProperty( boolean $v ) : void`

Set whether this is a user property (ro).

This is deprecated in Ant 1.5, but the userProperty attribute of the class is still being set via constructor, so Phing will allow this method to function.

Parameters

Name | Type | Description
--- | --- | ---
$v | boolean |

`setValue( mixed $value ) : void`

Sets a the value of current property component.

Parameters

Name | Type | Description
--- | --- | ---
$value | mixed | Value of name, all scalars allowed

`toString( ) : void`

Documentation was generated by DocBlox 0.17.1.