AloFramework Handlers 2.0 API
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo

Namespaces

  • AloFramework
    • Handlers
      • Config
      • Output
        • Styles
  • PHP

Classes

  • AbstractHandler
  • Error
  • ErrorHandler
  • ExceptionHandler
  • ShutdownHandler

Class ExceptionHandler

Exception handling class

AloFramework\Handlers\AbstractHandler implements AloFramework\Config\Configurable uses AloFramework\Config\ConfigurableTrait (not available)
Extended by AloFramework\Handlers\ExceptionHandler
Namespace: AloFramework\Handlers
Author: Art a.molcanovas@gmail.com
Since:

1.4 Uses the Configurable interface
1.2 Tracks the last set handler & exception
1.1 log() accepts the $includeLocation parameter


Located at class/ExceptionHandler.php

Methods summary

public
# __construct( Psr\Log\LoggerInterface $logger = null, AloFramework\Handlers\Config\ExceptionConfig $cfg = null )

Constructor

Constructor

Parameters

$logger
If provided, this will be used to log exceptions.
$cfg
The configuration class

Author

Art a.molcanovas@gmail.com

Since

1.4 $cfg added. This will become the first parameter in the constructor in 2.0

Overrides

AloFramework\Handlers\AbstractHandler::__construct
public static AloFramework\Handlers\ExceptionHandler|null
# getLastRegisteredHandler( )

Returns the last registered handler

Returns the last registered handler

Returns

AloFramework\Handlers\ExceptionHandler|null

Author

Art a.molcanovas@gmail.com

Since

1.2
public static Exception|null
# getLastReportedException( )

Returns the last reported exception

Returns the last reported exception

Returns

Exception|null
The last reported exception or NULL if none have been reported

Author

Art a.molcanovas@gmail.com

Since

1.2
public static boolean
# isRegistered( )

Checks whether the handler has been registered

Checks whether the handler has been registered

Returns

boolean

Author

Art a.molcanovas@gmail.com
public static AloFramework\Handlers\ExceptionHandler
# register( Psr\Log\LoggerInterface $logger = null, AloFramework\Handlers\Config\ExceptionConfig $cfg = null )

Registers the exception handler

Registers the exception handler

Parameters

$logger
If provided, this will be used to log errors and exceptions.
$cfg
Your custom configuration settings

Returns

AloFramework\Handlers\ExceptionHandler
The created handler instance

Author

Art a.molcanovas@gmail.com

Since

1.4 $cfg added
1.0.4 Checks what class has called the method instead of explicitly registering ExceptionHandler - allows easy class extendability.


public
# handle( Exception $e )

Exception handler

Exception handler

Parameters

$e
The exception

Author

Art a.molcanovas@gmail.com

Codecoverageignore

protected
# handleCLI( Exception $e )

Handles the exception with CLI output

Handles the exception with CLI output

Parameters

$e
The exception

Author

Art a.molcanovas@gmail.com

Codecoverageignore

protected
# echoPreviousExceptions( null|Exception $e, integer $level = 0 )

Echoes previous exceptions if applicable

Echoes previous exceptions if applicable

Parameters

$e
The previous exception
$level
How many previous exceptions have been echoed so far

Author

Art a.molcanovas@gmail.com

Codecoverageignore

protected
# handleHTML( Exception $e )

Handles an exception with HTML output

Handles an exception with HTML output

Parameters

$e
The exception

Author

Art a.molcanovas@gmail.com
protected
# log( Exception $e, boolean $includeLocation = true )

Logs a message if the logger is enabled

Logs a message if the logger is enabled

Parameters

$e
The exception to log
$includeLocation
Whether to include the file and line where the exception occurred

Author

Art a.molcanovas@gmail.com

Since

1.1 Accepts the $includeLocation parameter
public string
# __toString( )

Returns a string representation of the handler

Returns a string representation of the handler

Returns

string

Author

Art a.molcanovas@gmail.com

Overrides

AloFramework\Handlers\AbstractHandler::__toString

Methods inherited from AloFramework\Handlers\AbstractHandler

getTrace(), injectCSS()

Constants summary

Constants inherited from AloFramework\Handlers\AbstractHandler

EOL

Properties summary

Properties inherited from AloFramework\Handlers\AbstractHandler

$console, $isCLI, $logger

Magic properties

public AloFramework\Handlers\Config\ExceptionConfig $config

Handler configuration

AloFramework Handlers 2.0 API API documentation generated by ApiGen