PHP Class PEAR_PackageFile

Author: Greg Beaver ([email protected])
Mostrar archivo Open project: sourcefabric/newscoop Class Usage Examples

Public Properties

Property Type Description
$_config PEAR_Config
$_debug
$_extractErrors array helper for extracting Archive_Tar errors
$_logger
$_rawReturn boolean

Public Methods

Method Description
PEAR_PackageFile ( PEAR_Config &$config, ? $debug = false )
_extractErrors ( PEAR_Error | null $err = null ) : array helper callback for extracting Archive_Tar errors
addTempFile ( string $file ) : void Register a temporary file or directory. When the destructor is executed, all registered temporary files and directories are removed.
factory ( integer $version ) : PEAR_PackageFile_v1 Create a PEAR_PackageFile_v* of a given version.
fromAnyFile ( string $info, integer $state ) : PEAR_PackageFile_v1 | PEAR_PackageFile_v2 Create a PEAR_PackageFile_v* from a .tgz archive or package.xml file.
fromArray ( array $arr ) : PEAR_PackageFileManager_v1 | PEAR_PackageFileManager_v2 Create a PEAR_PackageFile_v* from its toArray() method
fromPackageFile ( string $descfile, integer $state, string | false $archive = false ) : PEAR_PackageFile_v1 | PEAR_PackageFile_v2 Create a PEAR_PackageFile_v* from a package.xml file.
fromTgzFile ( $file, $state ) : PEAR_PackageFile_v1 | PEAR_PackageFile_v2 Create a PEAR_PackageFile_v* from a compresed Tar or Tgz file.
fromXmlString ( string $data, integer $state, string $file, string $archive = false ) : PEAR_PackageFile_v1 | PEAR_PackageFile_v2 Create a PEAR_PackageFile_v* from an XML string.
getClassPrefix ( ) : string For simpler unit-testing
parserFactory ( integer $version ) : PEAR_PackageFile_Parser_v1 Create a PEAR_PackageFile_Parser_v* of a given version.
rawReturn ( ) Turn off validation - return a parsed package.xml without checking it
setLogger ( &$l )

Method Details

PEAR_PackageFile() public method

public PEAR_PackageFile ( PEAR_Config &$config, ? $debug = false )
$config PEAR_Config
$debug ?

_extractErrors() public method

helper callback for extracting Archive_Tar errors
public _extractErrors ( PEAR_Error | null $err = null ) : array
$err PEAR_Error | null
return array

addTempFile() public method

Register a temporary file or directory. When the destructor is executed, all registered temporary files and directories are removed.
public addTempFile ( string $file ) : void
$file string name of file or directory
return void

factory() public method

Create a PEAR_PackageFile_v* of a given version.
public factory ( integer $version ) : PEAR_PackageFile_v1
$version integer
return PEAR_PackageFile_v1

fromAnyFile() public method

This method is able to extract information about a package from a .tgz archive or from a XML package definition file.
public fromAnyFile ( string $info, integer $state ) : PEAR_PackageFile_v1 | PEAR_PackageFile_v2
$info string file name
$state integer package state (one of PEAR_VALIDATE_* constants)
return PEAR_PackageFile_v1 | PEAR_PackageFile_v2

fromArray() public method

WARNING: no validation is performed, the array is assumed to be valid, always parse from xml if you want validation.
public fromArray ( array $arr ) : PEAR_PackageFileManager_v1 | PEAR_PackageFileManager_v2
$arr array
return PEAR_PackageFileManager_v1 | PEAR_PackageFileManager_v2

fromPackageFile() public method

Create a PEAR_PackageFile_v* from a package.xml file.
public fromPackageFile ( string $descfile, integer $state, string | false $archive = false ) : PEAR_PackageFile_v1 | PEAR_PackageFile_v2
$descfile string name of package xml file
$state integer package state (one of PEAR_VALIDATE_* constants)
$archive string | false name of the archive this package.xml came from, if any
return PEAR_PackageFile_v1 | PEAR_PackageFile_v2

fromTgzFile() public method

Create a PEAR_PackageFile_v* from a compresed Tar or Tgz file.
public fromTgzFile ( $file, $state ) : PEAR_PackageFile_v1 | PEAR_PackageFile_v2
return PEAR_PackageFile_v1 | PEAR_PackageFile_v2

fromXmlString() public method

Create a PEAR_PackageFile_v* from an XML string.
public fromXmlString ( string $data, integer $state, string $file, string $archive = false ) : PEAR_PackageFile_v1 | PEAR_PackageFile_v2
$data string contents of package.xml file
$state integer package state (one of PEAR_VALIDATE_* constants)
$file string full path to the package.xml file (and the files it references)
$archive string optional name of the archive that the XML was extracted from, if any
return PEAR_PackageFile_v1 | PEAR_PackageFile_v2

getClassPrefix() public method

For simpler unit-testing
public getClassPrefix ( ) : string
return string

parserFactory() public method

Create a PEAR_PackageFile_Parser_v* of a given version.
public parserFactory ( integer $version ) : PEAR_PackageFile_Parser_v1
$version integer
return PEAR_PackageFile_Parser_v1

rawReturn() public method

This is used by the package-validate command
public rawReturn ( )

setLogger() public method

public setLogger ( &$l )

Property Details

$_config public_oe property

public PEAR_Config $_config
return PEAR_Config

$_debug public_oe property

public $_debug

$_extractErrors public_oe property

helper for extracting Archive_Tar errors
public array $_extractErrors
return array

$_logger public_oe property

public $_logger

$_rawReturn public_oe property

public bool $_rawReturn
return boolean