Exemple #1
0
 /**
  * @covers ::toArray
  */
 public function testToArray()
 {
     $this->assertNotEmpty(Errors::toArray());
     $this->assertContains(E_ERROR, Errors::toArray());
     $this->assertContains(E_RECOVERABLE_ERROR, Errors::toArray());
 }
Exemple #2
0
 /**
  * Calls the error callback
  * 
  * Called by ::handleCoreError() and ::handleUncaughtException() when the type of error
  * captured matches an error being handled. This method calls the error callback, and
  * effectively shuts down the handler.
  * 
  * @param Exception $exception  The error
  * @param string    $label      Label for the reason the error is being triggered
  *
  * @return bool
  */
 protected function triggerError(Exception $exception, $label)
 {
     $this->unhandle();
     $this->last_error = $exception;
     if ($exception instanceof Exceptions\PHPErrorException) {
         $type = Errors::toString($exception->getCode());
     } else {
         $code = $exception->getCode();
         $type = get_class($exception);
         $type = "{$type}[{$code}]";
     }
     $this->logger->error('{label} {type}: "{message}" in file {file}[{line}].', ["label" => $label, "type" => $type, "message" => $exception->getMessage(), "file" => $exception->getFile(), "line" => $exception->getLine()]);
     try {
         call_user_func($this->getCallback(), $this);
     } catch (Exception $e) {
     }
     return true;
 }