public function handleErrors($severity, $message, $filepath, $line)
    {
        if (error_reporting() == 0 || $severity == E_STRICT)
            return;

        if (false !== strpos($filepath, '/')) {
            $x = explode('/', $filepath);
            $filepath = $x[count($x)-3].'/'.$x[count($x)-2].'/'.end($x);
        }

        $mess = $this->getLevel($severity).'('.$severity.'):  '.$message. ' in '.$filepath.' on line '.$line;

        /*
         * shouldn't need to log the error here as the exception will handle the logging.
         */
        /*
        $context = (isset($_SERVER['CONTEXT']) ? $_SERVER['CONTEXT'] : 'none');
        if (array_key_exists('SITE', $_SERVER)) {
            $appName = (string) $_SERVER['SITE']['slug'];
            if ($appName === $context) {
                $appName = $this->SiteService->getAnchoredSite()->Slug;
            }
        } else {
            $appName = $_SERVER['SERVER_NAME'];
        }
        error_log("[{$this->environment}][$appName][$context][PHP_ERROR] " .  $mess);
        */

        if($severity == E_RECOVERABLE_ERROR)
            throw new Exception($mess);

        if (($severity & error_reporting()) == $severity) {
            if($this->redeployOnError && isset($this->ApplicationContext))
                $this->ApplicationContext->clearContextFiles();

            throw new Exception($mess);
        }

        return true;
    }
public function handleErrors($severity, $message, $filepath, $line)
    {
        if (error_reporting() == 0 || $severity == E_STRICT)
            return;

        if (false !== strpos($filepath, '/')) {
            $x = explode('/', $filepath);
            $filepath = $x[count($x)-3].'/'.$x[count($x)-2].'/'.end($x);
        }

        $mess = $this->getLevel($severity).'('.$severity.'):  '.$message. ' in '.$filepath.' on line '.$line;

        /*
         * shouldn't need to log the error here as the exception will handle the logging.
         */
        /*
        $context = (isset($_SERVER['CONTEXT']) ? $_SERVER['CONTEXT'] : 'none');
        if (array_key_exists('SITE', $_SERVER)) {
            $appName = (string) $_SERVER['SITE']['slug'];
            if ($appName === $context) {
                $appName = $this->SiteService->getAnchoredSite()->Slug;
            }
        } else {
            $appName = $_SERVER['SERVER_NAME'];
        }
        error_log("[{$this->environment}][$appName][$context][PHP_ERROR] " .  $mess);
        */

        if($severity == E_RECOVERABLE_ERROR)
            throw new Exception($mess);

        if (($severity & error_reporting()) == $severity) {
            if($this->redeployOnError && isset($this->ApplicationContext))
                $this->ApplicationContext->clearContextFiles();

            throw new Exception($mess);
        }

        return true;
    }
public function handleErrors ( $ severity , $ message , $ filepath , $ line ) { if ( error_reporting ( ) == 0 || $ severity == E_STRICT ) return ; if ( false !== strpos ( $ filepath , '/' ) ) { $ x = explode ( '/' , $ filepath ) ; $ filepath = $ x [ count ( $ x ) - 3 ] . '/' . $ x [ count ( $ x ) - 2 ] . '/' . end ( $ x ) ; } $ mess = $ this -> getLevel ( $ severity ) . '(' . $ severity . '):  ' . $ message . ' in ' . $ filepath . ' on line ' . $ line ; /*
         * shouldn't need to log the error here as the exception will handle the logging.
         */ /*
        $context = (isset($_SERVER['CONTEXT']) ? $_SERVER['CONTEXT'] : 'none');
        if (array_key_exists('SITE', $_SERVER)) {
            $appName = (string) $_SERVER['SITE']['slug'];
            if ($appName === $context) {
                $appName = $this->SiteService->getAnchoredSite()->Slug;
            }
        } else {
            $appName = $_SERVER['SERVER_NAME'];
        }
        error_log("[{$this->environment}][$appName][$context][PHP_ERROR] " .  $mess);
        */ if ( $ severity == E_RECOVERABLE_ERROR ) throw new Exception ( $ mess ) ; if ( ( $ severity & error_reporting ( ) ) == $ severity ) { if ( $ this -> redeployOnError && isset ( $ this -> ApplicationContext ) ) $ this -> ApplicationContext -> clearContextFiles ( ) ; throw new Exception ( $ mess ) ; } return true ; }
Defines the error handler that will be used when this class is created.

Using error_log, this function will record the error.

@param string $severity The severity of the error
@param string $message  The error message
@param string $filepath The file where the error was encountered
@param string $line     The line number where the error occured

@return void|boolean
Defines the error handler that will be used when this class is created .