Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcExecution

Execution::ezcExecution

Class ezcExecution

Class for handling fatal errors

This class allows you to invoke a handler whenever a fatal error occurs, or when an uncatched exception happens. You can specify which callback function to use and signal whether your application cleanly exited.

Example:

  1.  <?php
  2.  class myExecutionHandler extends ezcExecutionBasicErrorHandler
  3.  {
  4.      public static function onError( Exception $exception = null )
  5.      {
  6.          echo "Error!\n";
  7.          // If you want, you can use the parent's onError method, but that
  8.          // will only show a standard message.
  9.          parent::onError( $exception );
  10.      }
  11.  }
  12.  
  13.  ezcExecution::init( 'myExecutionHandler' );
  14.  
  15.  // ....
  16.  
  17.  ?>

Source for this file: /Execution/src/execution.php

Version:   //autogentag//

Method Summary

public static void cleanExit( )
Marks the current application as cleanly-exited.
public static void exceptionCallbackHandler( $e )
Handler for uncaught exceptions.
public static void init( $callbackClassName )
Initializes the ezcExecution environment.
public static void reset( )
Resets the ezcExecution environment.
public static void shutdownCallbackHandler( )
Shutdown handler

Methods

cleanExit

static void cleanExit( )

Marks the current application as cleanly-exited.

With this method you signal the ezcExecution environment that your application ended without errors. This is usually done just before you reach the end of your script, or just before you call exit() or die().

Exceptions:
Type Description
ezcExecutionNotInitializedException if the environment was not yet initialized.

exceptionCallbackHandler

static void exceptionCallbackHandler( $e )

Handler for uncaught exceptions.

The ezcExecution environment installs this method as handler for uncaught exceptions and will be called when one is found. This method's only function is to call the ::onError() static method of the error handler set with the init() method. It passes along the uncaught exception to this method.

This method has to be public otherwise PHP can not call it, but you should never call this method yourself.

Parameters:
Name Type Description
$e Exception

init

static void init( string $callbackClassName )

Initializes the ezcExecution environment.

With this method you initialize the ezcExecution environment. You need to specify a class name $callBackClassName that will be used to call the onError() method on in case of an error. The class name that you pass should implement the ezcExecutionErrorHandler interface. This method takes care of registering the uncaught exception and shutdown handlers.

Parameters:
Name Type Description
$callbackClassName string
Exceptions:
Type Description
ezcExecutionAlreadyInitializedException if the environment was already initialized.
ezcExecutionInvalidCallbackException if an unknown callback class was passed.
ezcExecutionWrongClassException if an invalid callback class was passed.

reset

static void reset( )

Resets the ezcExecution environment.

With this function you reset the environment. Usually this method should not be used, but in the cases when you want to restart the environment this is the method to use. It also takes care of restoring the user defined uncaught exception handler, but it can not undo the registered shutdown handler as PHP doesn't provide that functionality.

shutdownCallbackHandler

static void shutdownCallbackHandler( )

Shutdown handler

The ezcExecution environment installs this method as general shutdown handler. This method's only function is to call the ::onError() static method of the error handler set with the init() method.

Documentation generated by phpDocumentor 1.4.3