Constants

XMLNAMESPACE

XMLNAMESPACE

The package.xml namespace

XMLTASKSNAMESPACE

XMLTASKSNAMESPACE

The package.xml tasks namespace

Properties

$_xml

$_xml : \DOMDocument

The parsed XML.

Type

\DOMDocument

$_path

$_path : string

The path to the XML file.

Type

string

$_xpath

$_xpath : \DOMXpath

The XPath query handler.

Type

\DOMXpath

$_namespace_prefix

$_namespace_prefix : string

The XPath namespace prefix (if necessary).

Type

string

Methods

__construct()

__construct(resource|string  $xml,   $factory = null) 

Constructor.

Parameters

resource|string $xml

The package.xml as stream or path.

$factory

getContent()

getContent(  $type = 'horde',   $path = null) : \Horde_Pear_Package_Contents_List

Return the list of contents.

Parameters

$type
$path

Returns

\Horde_Pear_Package_Contents_List

The contents.

getName()

getName() : string

Return the package name.

Returns

string —

The name of the package.

getChannel()

getChannel() : string

Return the package channel.

Returns

string —

The channel of the package.

getSummary()

getSummary() : string

Return the package summary.

Returns

string —

The summary of the package.

getDescription()

getDescription() : string

Return the package description.

Returns

string —

The description of the package.

getVersion()

getVersion() : string

Return the package version.

Returns

string —

The version of the package.

getVersions()

getVersions() : array

Returns all package versions from the changelog.

Returns

array —

A list of versions and stabilities.

getDate()

getDate() : string

Return the release date.

Returns

string —

The date for the current release.

getNotes()

getNotes() : string

Return the package notes.

Returns

string —

The notes for the current release.

getState()

getState(string  $key = 'release') : string

Return the stability of the release or api.

Parameters

string $key

"release" or "api"

Returns

string —

The stability.

getDependencies()

getDependencies() : array

Return the package dependencies.

Returns

array —

The package dependencies.

getLicense()

getLicense() : string

Return the license name.

Returns

string —

The name of the license.

getLicenseLocation()

getLicenseLocation() : string

Return the URL to the license information.

Returns

string —

The license URI.

getLeads()

getLeads() : string

Return the package lead developers.

Returns

string —

The package lead developers.

__call()

__call(string  $name, array  $arguments) : mixed

Catch undefined method calls and try to run them as task.

Parameters

string $name

The method/task name.

array $arguments

The arguments for the call.

Returns

mixed

timestamp()

timestamp(boolean  $keepTime = false) 

Mark the package as being release and set the timestamps to now.

Parameters

boolean $keepTime

Keep the

syncCurrentVersion()

syncCurrentVersion() : NULL

Synchronizes the current version information with the release information in the changelog.

Returns

NULL

addNote()

addNote(string  $note) 

Add a new note to the package.xml

Parameters

string $note

The note text.

setNotes()

setNotes(array  $notes) 

Sets notes in the package.xml

Parameters

array $notes

setVersion()

setVersion(string  $rel_version = null, string  $api_version = null) : NULL

Set the version in the package.xml

Parameters

string $rel_version

The new release version number.

string $api_version

The new api version number.

Returns

NULL

setState()

setState(string  $rel_state = null, string  $api_state = null) : NULL

Set the state in the package.xml

Parameters

string $rel_state

The new release state number.

string $api_state

The new api state number.

Returns

NULL

addAuthor()

addAuthor(string  $name, string  $user, string  $email, boolean  $active, string  $role) 

Adds a new author to the package.xml

Parameters

string $name

A name.

string $user

A user name.

string $email

An email address.

boolean $active

Still active?

string $role

An author role.

addDependency()

addDependency(string  $required, string  $type,   $constraints) 

Adds a new dependency to the package.xml

Parameters

string $required

A dependency requirement, either 'required' or 'optional'.

string $type

A dependency type, either 'package' or 'extension'.

$constraints

addNextVersion()

addNextVersion(string  $version, string  $initial_note, string  $stability_api = null, string  $stability_release = null, boolean  $keepTime = false) 

Add the next version to the package.xml

Parameters

string $version

The new version number.

string $initial_note

The text for the initial note.

string $stability_api

The API stability for the next release.

string $stability_release

The stability for the next release.

boolean $keepTime

Keep the

addVersion()

addVersion(string  $version, string  $api, string  $stability_release, string  $stability_api, string  $date, string  $license, string  $licenseLocation, string  $notes) 

Adds a new version to the package.xml

Parameters

string $version

The new version number.

string $api

The new api number.

string $stability_release

The stability for the next release.

string $stability_api

The API stability for the next release.

string $date

The release date.

string $license

The license identifier.

string $licenseLocation

The license URI.

string $notes

The text for the release notes.

__toString()

__toString() : string

Return the complete package.xml as string.

Returns

string —

The package.xml content.

findNode()

findNode(string  $query) : \DOMNode|false

Return a single named node matching the given XPath query.

Parameters

string $query

The query.

Returns

\DOMNode|false —

The named DOMNode or empty if no node was found.

findNodeRelativeTo()

findNodeRelativeTo(string  $query, \DOMNode  $context) : \DOMNode|false

Return a single named node below the given context matching the given XPath query.

Parameters

string $query

The query.

\DOMNode $context

Search below this node.

Returns

\DOMNode|false —

The named DOMNode or empty if no node was found.

findNodes()

findNodes(string  $query) : \DOMNodeList

Return all nodes matching the given XPath query.

Parameters

string $query

The query.

Returns

\DOMNodeList —

The list of DOMNodes.

findNodesRelativeTo()

findNodesRelativeTo(string  $query,   $context) : \DOMNodeList

Return all nodes matching the given XPath query.

Parameters

string $query

The query.

$context

Returns

\DOMNodeList —

The list of DOMNodes.

getNodeText()

getNodeText(string  $path) : string|false

Return the content of a single named node matching the given XPath query.

Parameters

string $path

The node path.

Returns

string|false —

The node content as string or empty if no node was found.

getNodeTextRelativeTo()

getNodeTextRelativeTo(string  $path, \DOMNode  $context) : string|false

Return the content of a single named node below the given context and matching the given XPath query.

Parameters

string $path

The node path.

\DOMNode $context

Search below this node.

Returns

string|false —

The node content as string or empty if no node was found.

replaceTextNode()

replaceTextNode(string  $path, string  $value) : \DOMNodeList

Replace a specific text node

Parameters

string $path

The XPath query pointing to the node.

string $value

The new text value.

Returns

\DOMNodeList —

The list of DOMNodes.

replaceTextNodeRelativeTo()

replaceTextNodeRelativeTo(string  $path, \DOMNode  $context, string  $value,   $attributes = array()) : \DOMNodeList

Replace a specific text node

Parameters

string $path

The XPath query pointing to the node.

\DOMNode $context

Search below this node.

string $value

The new text value.

$attributes

Returns

\DOMNodeList —

The list of DOMNodes.

_insertWhiteSpace()

_insertWhiteSpace(\DOMNode  $parent, string  $ws) : \DOMNode

Insert some white space.

Parameters

\DOMNode $parent

The parent DOMNode.

string $ws

Additional white space that should be inserted.

Returns

\DOMNode —

The inserted white space node.

insert()

insert(  $elements,   $point) 

Parameters

$elements
$point

append()

append(  $elements,   $parent) 

Parameters

$elements
$parent

createText()

createText(  $text) 

Parameters

$text

createComment()

createComment(  $comment) 

Parameters

$comment

createNode()

createNode(  $name,   $attributes = array(),   $ns = null) 

Parameters

$name
$attributes
$ns

removeWhitespace()

removeWhitespace(  $node) 

Parameters

$node

removeComment()

removeComment(  $node,   $comment) 

Parameters

$node
$comment

_warnOnEmptyInfo()

_warnOnEmptyInfo(string  $version, array  $info) 

Write a warning to STDERR when missing the specified entries in the $info array.

Parameters

string $version

The version the note entry is for.

array $info

The note info entry.

_fetchCurrentRelease()

_fetchCurrentRelease() : \DOMElement|NULL

Fetch the node holding the current release information in the changelog.

Returns

\DOMElement|NULL —

The release node or empty if no such node was found.

_fetchRelease()

_fetchRelease(string  $version) : \DOMElement|NULL

Fetch the node holding release information in the changelog.

Parameters

string $version

Version to fetch the release information from.

Returns

\DOMElement|NULL —

The release node or empty if no such node was found.

_completeDependencies()

_completeDependencies(\DOMNode  $parent,   $result, string  $optional) : NULL

Complete the dependency information.

Parameters

\DOMNode $parent

The parent node ("required" or "optional").

$result
string $optional

Optional dependency or not?

Returns

NULL

_dependencyInputValue()

_dependencyInputValue(  $input, string  $name, \DOMNode  $node) : NULL

Generate one element of the input data.

Parameters

$input
string $name

Value name.

\DOMNode $node

The dependency node.

Returns

NULL

_appendVersion()

_appendVersion(\DOMNode  $parent, string  $version, string  $api, string  $ws = '') : NULL

Append version information.

Parameters

\DOMNode $parent

The parent DOMNode.

string $version

The version.

string $api

The api version.

string $ws

Additional white space that should be inserted.

Returns

NULL

_appendStability()

_appendStability(\DOMNode  $parent, string  $release, string  $api, string  $ws = null) : NULL

Append stability information.

Parameters

\DOMNode $parent

The parent DOMNode.

string $release

The release stability.

string $api

The api stability.

string $ws

Additional white space that should be inserted.

Returns

NULL

_appendLicense()

_appendLicense(\DOMNode  $parent, string  $license, string  $uri, string  $ws = null) : NULL

Append license information.

Parameters

\DOMNode $parent

The parent DOMNode.

string $license

The license name.

string $uri

The license URI.

string $ws

Additional white space that should be inserted.

Returns

NULL

_requireCurrentRelease()

_requireCurrentRelease() : \DOMElement|NULL

Fetch the node holding the current release information in the changelog and fail if there is no such node.

Throws

\Horde_Pear_Exception

If the node does not exist.

Returns

\DOMElement|NULL —

The release node.

_findSingleNode()

_findSingleNode(\DOMNodeList  $result) : \DOMNode|false

Return a single node for the result set.

Parameters

\DOMNodeList $result

The query result.

Returns

\DOMNode|false —

The DOMNode or empty if no node was found.

_replacementNode()

_replacementNode(\DOMNode  $old_node, string  $value) : \DOMNode

Generate a replacement node.

Parameters

\DOMNode $old_node

The old DOMNode to be replaced.

string $value

The new text value.

Returns

\DOMNode —

The new DOMNode.

_appendChild()

_appendChild(\DOMNode  $parent, string  $name, string  $value, string  $ws = '') : \DOMNode

Append a new child.

Parameters

\DOMNode $parent

The parent DOMNode.

string $name

The tag name of the new node.

string $value

The text content of the new node.

string $ws

Additional white space that should be inserted.

Returns

\DOMNode —

The appended child.