# classes/phing/tasks/ext/PearPackageTask.php

## \PearPackageTask
jump to top

A task to create PEAR package.xml file.

This class uses the PEAR_PackageFileMaintainer class to perform the work.

This class is designed to be very flexible -- i.e. account for changes to the package.xml w/o requiring changes to this class. We've accomplished this by having generic and nested elements. All options are set using PEAR_PackageFileMaintainer::setOptions().

The tag is used to set a simple option value. `or option_value`

The tag represents a complex data type. You can use nested (and nested with tags) to represent the full complexity of the structure. Bear in mind that what you are creating will be mapped to an associative array that will be passed in via PEAR_PackageFileMaintainer::setOptions(). ``

Here's an over-simple example of how this could be used: `Sample release notes here. Package description Short description`

Look at the build.xml in the Phing base directory (assuming you have the full distro / CVS version of Phing) to see a more complete example of how to call this script.

Extends from
  \MatchingTask
author
  Hans Lellelid
copyright
  2001,2002 THYRELL. All rights reserved
package
  phing.tasks.ext
version
  $Id: PearPackageTask.php 1162 2011-06-17 21:24:01Z mrook $

### Properties

`$dir= ''`

Base directory for reading files.

Details

Type

`array $filesets= 'array'`

FileSet[]
Default value `array` Details

Type
  array

`$mappings= 'array'`

Nested <mapping> (complex options) types.

Default value `array` Details

Type

`array $options= 'array'`

PearPkgOption[]
Default value `array` Details

Type
  array

`$package= ''`

Details

Type

`$packageFile= ''`

Package file

Details

Type

`\PEAR_PackageFileManager $pkg= ''`

Details

Type
  \PEAR_PackageFileManager

`$preparedOptions= 'array'`
Default value `array` Details

Type

`\PearPkgRole[] $roles= 'array'`

Nested <role> elements

Default value `array` Details

Type
  \PearPkgRole[]

### Methods

`createFileSet( ) : \FileSet`
Nested creator, creates a FileSet for this task
Returns

Type | Description
--- | ---
\FileSet |

`createMapping( ) :`
Handles nested generic elements.
`createOption( ) :`
Handles nested generic elements.
`createRole( ) : \PearPkgRole`
Handles nested elements
Returns

Type | Description
--- | ---
\PearPkgRole |

`fixDeps( $deps ) :`
Fixes the boolean in optional dependencies
Parameters

Name | Type | Description
--- | --- | ---
$deps |  |

`getFileSets( ) : array`
Used by the PEAR_PackageFileManager_PhingFileSet lister.
Returns

Type | Description
--- | ---
array |

`init( ) :`
`main( ) : void`
Main entry point.
`populateOptions( ) :`
Adds the options that are set via attributes and the nested tags to the options array.
`setDestFile( $f ) :`
Sets the file to use for generated package.xml
Parameters

Name | Type | Description
--- | --- | ---
$f |  |

`setDir( \PhingFile $f ) : void`
Sets "dir" property from XML.
Parameters

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

`setName( string $v ) : void`
Sets "name" property from XML.
Parameters

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

`setOptions( ) : void`
Sets PEAR package.xml options, based on class properties.
`setPackage( string $v ) : void`
Set "package" property from XML.
Parameters

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

Details

see
  \setName()

## \PearPkgMapping
jump to top

Handles complex options <mapping> elements which are hashes (assoc arrays).

package
  phing.tasks.ext

### Properties

`$elements= 'array'`
Default value `array` Details

Type

`$name= ''`
Details

Type

### Methods

`createElement( ) :`
`getElements( ) :`
`getName( ) :`
`getValue( ) : array`
Returns the PHP hash or array of hashes (etc.) that this mapping represents.
Returns

Type | Description
--- | ---
array |

`setName( $v ) :`
Parameters

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

## \PearPkgMappingElement
jump to top

Sub-element of <mapping>.

package
  phing.tasks.ext

### Properties

`$elements= 'array'`
Default value `array` Details

Type

`$key= ''`
Details

Type

`$value= ''`
Details

Type

### Methods

`createElement( ) :`
Handles nested tags.
`getKey( ) :`
`getValue( ) : mixed`
Returns either the simple value or the calculated value (array) of nested elements.
Returns

Type | Description
--- | ---
mixed |

`setKey( $v ) :`
Parameters

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

`setValue( $v ) :`
Parameters

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

## \PearPkgOption
jump to top

Generic option class is used for non-complex options.

package
  phing.tasks.ext

### Properties

`$name= ''`
Details

Type

`$value= ''`
Details

Type

### Methods

`addText( $txt ) :`
Parameters

Name | Type | Description
--- | --- | ---
$txt |  |

`getName( ) :`
`getValue( ) :`
`setName( $v ) :`
Parameters

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

`setValue( $v ) :`
Parameters

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

## \PearPkgRole
jump to top

Encapsulates file roles

package
  phing.tasks.ext

### Properties

`string $extension= ''`

Details

Type
  string

`string $role= ''`

Details

Type
  string

### Methods

`getExtension( ) : string`
Retrieves the file extension
Returns

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

`getRole( ) : string`
Retrieves the role
Returns

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

`setExtension( string $extension ) :`
Sets the file extension
Parameters

Name | Type | Description
--- | --- | ---
$extension | string |

`setRole( string $role ) :`
Sets the role
Parameters

Name | Type | Description
--- | --- | ---
$role | string |

Documentation was generated by DocBlox 0.13.1.