classes/phing/tasks/ext/PearPackageTask.php

\PearPackageTask

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

The

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:

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

Propertyprotected  $dir= ''

Base directory for reading files.

Details
Type
Propertyprivatearray  $filesets= 'array'

FileSet[]
Default valuearrayDetails
Type
array
Propertyprotected  $mappings= 'array'

Nested <mapping> (complex options) types.

Default valuearrayDetails
Type
Propertyprotectedarray  $options= 'array'

PearPkgOption[]
Default valuearrayDetails
Type
array
Propertyprotected  $package= ''

Details
Type
Propertyprivate  $packageFile= ''

Package file

Details
Type
Propertyprotected\PEAR_PackageFileManager  $pkg= ''

Details
Type
\PEAR_PackageFileManager
Propertyprivate  $preparedOptions= 'array'
Default valuearrayDetails
Type
Propertyprotected\PearPkgRole[]  $roles= 'array'

Nested <role> elements

Default valuearrayDetails
Type
\PearPkgRole[]

Methods

methodpublic  createFileSet( ) : \FileSet
Nested creator, creates a FileSet for this task
Returns
Type Description
\FileSet
methodpublic  createMapping( ) :
Handles nested generic
methodpublic  createOption( ) :
Handles nested generic
methodpublic  createRole( ) : \PearPkgRole
Handles nested elements
Returns
Type Description
\PearPkgRole
methodprivate  fixDeps(  $deps ) :
Fixes the boolean in optional dependencies
Parameters
Name Type Description
$deps
methodpublic  getFileSets( ) : array
Used by the PEAR_PackageFileManager_PhingFileSet lister.
Returns
Type Description
array
methodpublic  init( ) :
methodpublic  main( ) : void
Main entry point.
methodprivate  populateOptions( ) :
Adds the options that are set via attributes and the nested tags to the options array.
methodpublic  setDestFile(  $f ) :
Sets the file to use for generated package.xml
Parameters
Name Type Description
$f
methodpublic  setDir( \PhingFile $f ) : void
Sets "dir" property from XML.
Parameters
Name Type Description
$f \PhingFile
methodpublic  setName( string $v ) : void
Sets "name" property from XML.
Parameters
Name Type Description
$v string
methodprotected  setOptions( ) : void
Sets PEAR package.xml options, based on class properties.
methodpublic  setPackage( string $v ) : void
Set "package" property from XML.
Parameters
Name Type Description
$v string
Details
see
\setName()

\PearPkgMapping

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

package
phing.tasks.ext

Properties

Propertyprivate  $elements= 'array'
Default valuearrayDetails
Type
Propertyprivate  $name= ''
Details
Type

Methods

methodpublic  createElement( ) :
methodpublic  getElements( ) :
methodpublic  getName( ) :
methodpublic  getValue( ) : array
Returns the PHP hash or array of hashes (etc.) that this mapping represents.
Returns
Type Description
array
methodpublic  setName(  $v ) :
Parameters
Name Type Description
$v

\PearPkgMappingElement

Sub-element of <mapping>.

package
phing.tasks.ext

Properties

Propertyprivate  $elements= 'array'
Default valuearrayDetails
Type
Propertyprivate  $key= ''
Details
Type
Propertyprivate  $value= ''
Details
Type

Methods

methodpublic  createElement( ) :
Handles nested tags.
methodpublic  getKey( ) :
methodpublic  getValue( ) : mixed
Returns either the simple value or the calculated value (array) of nested elements.
Returns
Type Description
mixed
methodpublic  setKey(  $v ) :
Parameters
Name Type Description
$v
methodpublic  setValue(  $v ) :
Parameters
Name Type Description
$v

\PearPkgOption

Generic option class is used for non-complex options.

package
phing.tasks.ext

Properties

Propertyprivate  $name= ''
Details
Type
Propertyprivate  $value= ''
Details
Type

Methods

methodpublic  addText(  $txt ) :
Parameters
Name Type Description
$txt
methodpublic  getName( ) :
methodpublic  getValue( ) :
methodpublic  setName(  $v ) :
Parameters
Name Type Description
$v
methodpublic  setValue(  $v ) :
Parameters
Name Type Description
$v

\PearPkgRole

Encapsulates file roles

package
phing.tasks.ext

Properties

Propertyprivatestring  $extension= ''

Details
Type
string
Propertyprivatestring  $role= ''

Details
Type
string

Methods

methodpublic  getExtension( ) : string
Retrieves the file extension
Returns
Type Description
string
methodpublic  getRole( ) : string
Retrieves the role
Returns
Type Description
string
methodpublic  setExtension( string $extension ) :
Sets the file extension
Parameters
Name Type Description
$extension string
methodpublic  setRole( string $role ) :
Sets the role
Parameters
Name Type Description
$role string
Documentation was generated by DocBlox 0.13.1.