severity; } /** @return int */ public function setSeverity($severity = E_ERROR) { return $this->severity = $severity; } /** * Save the exceptions in the exceptions log file * @return void */ public function __destruct() { $debugging = (\Phacil\Framework\Config::DEBUG()) ?: false; $this->errorFormat = \Phacil\Framework\Config::DEBUG_FORMAT() ?: $this->errorFormat; $log = new \Phacil\Framework\Log($this->exceptionFile); $errorStamp = [ 'message' => $this->getMessage(), 'line' => $this->getLine(), 'severity' => $this->getSeverity(), 'file' => $this->getFile(), 'trace' => ($debugging) ? (($this->errorFormat == 'json') ? ($this->heritageTrace ?: $this->getTrace()) : \Phacil\Framework\Debug::trace(($this->heritageTrace ?: $this->getTrace()))) : null ]; if ($this->getCode() > 0) $errorStamp['code'] = $this->getCode(); $log->error(($this->errorFormat == 'json') ? json_encode($errorStamp) : implode(PHP_EOL, array_map( [self::class, 'convertArray'], $errorStamp, array_keys($errorStamp) ))); } }