PEAR
[ class tree: PEAR ] [ index: PEAR ] [ all elements ]

Class: PEAR

Source Location: /PEAR-1.10.12/PEAR.php

Class Overview


Base class for other PEAR classes. Provides rudimentary emulation of destructors.


Author(s):

Version:

  • Release: 1.10.12

Copyright:

  • 1997-2006 The PHP Group

Variables

Methods


Child classes:

PEAR_Common
Class providing common functionality for PEAR administration classes.
PEAR_Command_Common
PEAR commands base class
PEAR_Frontend
Singleton-based frontend for PEAR user input/output
PEAR_Config
This is a class for storing configuration data, keeping track of which are system-defined, user-defined or defaulted.
PEAR_Registry
Administration class used to maintain the installed package database.

Inherited Variables

Inherited Methods


Class Details

[line 84]
Base class for other PEAR classes. Provides rudimentary emulation of destructors.

If you want a destructor in your class, inherit PEAR and make a destructor method called _yourclassname (same name as the constructor, but with a "_" prefix). Also, in your constructor you have to call the PEAR constructor: $this->PEAR();. The destructor method will be called without parameters. Note that at in some SAPI implementations (such as Apache), any output during the request shutdown (in which destructors are called) seems to be discarded. If you need to get any debug information from your destructor, use error_log(), syslog() or something similar.

IMPORTANT! To use the emulated destructors you need to create the objects by reference: $obj =& new PEAR_child;



[ Top ]


Class Variables

$bivalentMethods = array(
        'setErrorHandling' => true,
        'raiseError' => true,
        'throwError' => true,
        'pushErrorHandling' => true,
        'popErrorHandling' => true,
    )

[line 140]

List of methods that can be called both statically and non-statically.
  • Access: protected

Type:   array


[ Top ]



Method Detail

PEAR (Constructor)   [line 192]

PEAR PEAR( [string $error_class = null])

Only here for backwards compatibility.

E.g. Archive_Tar calls $this->PEAR() in its constructor.

  • Access: public

Parameters:

string   $error_class   —  Which class to use for error objects, defaults to PEAR_Error.

[ Top ]

__construct (Constructor)   [line 158]

void __construct( [string $error_class = null])

Constructor. Registers this object in $_PEAR_destructor_object_list for destructor emulation if a destructor object exists.
  • Access: public

Overridden in child classes as:

PEAR_Common::__construct()
PEAR_Common constructor
PEAR_Downloader::__construct()
PEAR_Installer::__construct()
PEAR_Installer constructor.
PEAR_Builder::__construct()
PEAR_Builder constructor.
PEAR_Command_Common::__construct()
PEAR_Command_Common constructor.
PEAR_Command_Package::__construct()
PEAR_Command_Package constructor.
PEAR_Command_Pickle::__construct()
PEAR_Command_Package constructor.
PEAR_Command_Test::__construct()
PEAR_Command_Test constructor.
PEAR_Command_Build::__construct()
PEAR_Command_Build constructor.
PEAR_Command_Remote::__construct()
PEAR_Command_Remote constructor.
PEAR_Command_Config::__construct()
PEAR_Command_Config constructor.
PEAR_Command_Registry::__construct()
PEAR_Command_Registry constructor.
PEAR_Command_Channels::__construct()
PEAR_Command_Registry constructor.
PEAR_Command_Auth::__construct()
PEAR_Command_Auth constructor.
PEAR_Command_Install::__construct()
PEAR_Command_Install constructor.
PEAR_Command_Mirror::__construct()
PEAR_Command_Mirror constructor.
PEAR_Frontend_CLI::__construct()
PEAR_Config::__construct()
Constructor.
PEAR_Registry::__construct()
PEAR_Registry constructor.

Parameters:

string   $error_class   —  (optional) which class to use for error objects, defaults to PEAR_Error.

[ Top ]

_PEAR (Destructor)   [line 208]

void _PEAR( )

Destructor (the emulated type of...). Does nothing right now, but is included for forward compatibility, so subclass destructors should always call it.

See the note in the class desciption about output from destructors.

  • Access: public

[ Top ]

delExpect   [line 461]

mixed delExpect( mixed $error_code)

This method deletes all occurrences of the specified element from the expected error codes stack.
  • Return: list of error codes that were deleted or error
  • Since: PHP 4.3.0
  • Access: public

Parameters:

mixed   $error_code   —  error code that should be deleted

[ Top ]

expectError   [line 405]

int expectError( [mixed $code = '*'])

This method is used to tell which errors you expect to get.

Expected errors are always returned with error mode PEAR_ERROR_RETURN. Expected error codes are stored in a stack, and this method pushes a new element onto it. The list of expected errors are in effect until they are popped off the stack with the popExpect() method.

Note that this method can not be called statically

  • Return: the new depth of the "expected errors" stack
  • Access: public

Parameters:

mixed   $code   —  a single error code or an array of error codes to expect

[ Top ]

getSourceDateEpoch   [line 777]

int getSourceDateEpoch( )

Get SOURCE_DATE_EPOCH environment variable See https://reproducible-builds.org/specs/source-date-epoch/
  • Access: public

[ Top ]

getStaticProperty   [line 251]

mixed &getStaticProperty( string $class, string $var)

If you have a class that's mostly/entirely static, and you need static

properties, you can use this method to simulate them. Eg. in your method(s) do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar'); You MUST use a reference, or they will not persist!

  • Return: A reference to the variable. If not set it will be auto initialised to NULL.
  • Access: public

Parameters:

string   $class   —  The calling classname, to prevent clashes
string   $var   —  The variable to retrieve.

[ Top ]

isError   [line 296]

bool isError( mixed $data, [int $code = null])

Tell whether a value is a PEAR error.
  • Return: true if parameter is an error
  • Access: public

Parameters:

mixed   $data   —  the value to test
int   $code   —  if $data is an error object, return true only if $code is a string and $obj->getMessage() == $code or $code is an integer and $obj->getCode() == $code

[ Top ]

loadExtension   [line 741]

bool loadExtension( string $ext)

OS independent PHP extension load. Remember to take care on the correct extension name for case sensitive OSes.
  • Return: Success or not on the dl() call
  • Access: public

Parameters:

string   $ext   —  The extension name

[ Top ]

popExpect   [line 421]

array popExpect( )

This method pops one element off the expected error codes stack.
  • Return: the list of error codes that were popped

[ Top ]

registerShutdownFunc   [line 274]

void registerShutdownFunc( mixed $func, [mixed $args = array()])

Use this function to register a shutdown method for static classes.
  • Access: public

Parameters:

mixed   $func   —  The function name (or array of class/method) to call
mixed   $args   —  The arguments to pass to the function

[ Top ]

staticPopErrorHandling   [line 644]

void staticPopErrorHandling( )

  • Access: public

[ Top ]

staticPushErrorHandling   [line 609]

void staticPushErrorHandling( $mode, [ $options = null])

  • Access: public

Parameters:

   $mode   — 
   $options   — 

[ Top ]

_popErrorHandling   [line 720]

bool _popErrorHandling( $object)

Pop the last error handler used
  • Return: Always true
  • See: PEAR::pushErrorHandling
  • Access: protected

Parameters:

   $object   — 

[ Top ]

_pushErrorHandling   [line 692]

bool _pushErrorHandling( $object, mixed $mode, [mixed $options = null])

Push a new error handler on top of the error handler options stack. With this you can easily override the actual error handler for some code and restore it later with popErrorHandling.
  • Return: Always true
  • See: PEAR::setErrorHandling
  • Access: protected

Parameters:

mixed   $mode   —  (same as setErrorHandling)
mixed   $options   —  (same as setErrorHandling)
   $object   — 

[ Top ]

_raiseError   [line 521]

object a _raiseError( $object, [mixed $message = null], [int $code = null], [int $mode = null], [mixed $options = null], [string $userinfo = null], [string $error_class = null], [bool $skipmsg = false])

This method is a wrapper that returns an instance of the configured error class with this object's default error handling applied. If the $mode and $options parameters are not specified, the object's defaults are used.
  • Return: PEAR error object
  • See: PEAR::setErrorHandling
  • Since: PHP 4.0.5
  • Access: protected

Parameters:

mixed   $message   —  a text error message or a PEAR error object
int   $code   —  a numeric error code (it is up to your class to define these if you want to use codes)
int   $mode   —  One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT, PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE, PEAR_ERROR_CALLBACK, PEAR_ERROR_EXCEPTION.
mixed   $options   —  If $mode is PEAR_ERROR_TRIGGER, this parameter specifies the PHP-internal error level (one of E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR). If $mode is PEAR_ERROR_CALLBACK, this parameter specifies the callback function or method. In other error modes this parameter is ignored.
string   $userinfo   —  If you need to pass along for example debug information, this parameter is meant for that.
string   $error_class   —  The returned error object will be instantiated from this class, if specified.
bool   $skipmsg   —  If true, raiseError will only pass error codes, the error message parameter will be dropped.
   $object   — 

[ Top ]

_setErrorHandling   [line 352]

void _setErrorHandling( object $object, [int $mode = null], [mixed $options = null])

Sets how errors generated by this object should be handled.

Can be invoked both in objects and statically. If called statically, setErrorHandling sets the default behaviour for all PEAR objects. If called in an object, setErrorHandling sets the default behaviour for that object.


Parameters:

object   $object   —  Object the method was called on (non-static mode)
int   $mode   —  One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT, PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE, PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION.
mixed   $options   — 

When $mode is PEAR_ERROR_TRIGGER, this is the error level (one of E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR).

When $mode is PEAR_ERROR_CALLBACK, this parameter is expected to be the callback function or method. A callback function is a string with the name of the function, a callback method is an array of two elements: the element at index 0 is the object, and the element at index 1 is the name of the method to call in the object.

When $mode is PEAR_ERROR_PRINT or PEAR_ERROR_DIE, this is a printf format string used when printing the error message.


[ Top ]

_throwError   [line 598]

object a _throwError( $object, [mixed $message = null], [int $code = null], [string $userinfo = null])

Simpler form of raiseError with fewer options. In most cases message, code and userinfo are enough.
  • Return: PEAR error object
  • See: PEAR::raiseError
  • Access: protected

Parameters:

mixed   $message   —  a text error message or a PEAR error object
int   $code   —  a numeric error code (it is up to your class to define these if you want to use codes)
string   $userinfo   —  If you need to pass along for example debug information, this parameter is meant for that.
   $object   — 

[ Top ]

__call   [line 214]

void __call( $method, $arguments)

  • Access: public

Parameters:

   $method   — 
   $arguments   — 

[ Top ]

__callStatic   [line 227]

void __callStatic( $method, $arguments)

  • Access: public

Parameters:

   $method   — 
   $arguments   — 

[ Top ]


Documentation generated on Sun, 19 Apr 2020 14:22:13 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.