Display on console
@param string $code Header code
@param string $message Header message
@return mixed None
@throws \Exception
333725
public function displayConsole(string $code, string $message)
    {
        $str_additionnal = "\n\n";
        if ($this->type_error != null) {
            $str_additionnal .= " \nPHP Error type : ".$this->type_error;
        }
        if ($this->file_error != null) {
            $str_additionnal .= " \nFile : ".$this->file_error;
        }
        if ($this->line_error != null) {
            $str_additionnal .= " \nLine : ".$this->line_error;
        }

        \iumioFramework\Core\Additional\Manager\Display\OutputManager::displayAsError(
            "An exception was generated\n\nUidie : ".
            $this->uidie."\nTime : ". $this->time."\nType : ".
            $this->code." ".$this->codeTitle."\nEnv : ".
            $this->env."\nExplain : ". $this->explain.
            " \nSolution : ".$this->solution.$str_additionnal
        );

        exit(1);
    }
354706
public function abort(int $code, string $message = '', array $headers = [])
    {
        if ($code == 404) {
            throw new \Cygnite\Exception\Http\HttpNotFoundException($message);
        }

        throw new \Cygnite\Exception\Http\HttpException($code, $message, null, $headers);
    }
763025
static public function cThrow($message = null, \Exception $exception = null, $config = null)
    {

        if (!isset ($config ['display'])) {
            $config ['display'] = self::$displayTrace;
        }

        if (!isset ($config ['send'])) {
            $config ['send'] = self::$sendTrace;
        }

        if (!isset ($config ['write'])) {
            $config ['write'] = self::$writeTrace;
        }

        $retVal = '';

        if (empty ($message)) {
            $message = self::$standardErrorText;
        }

        $retVal .= self::displayBox($message);

        /**
         * if exception has been sent, try to display or send it
         */
        if (!empty ($exception)) {

            $errorFullText = self::formatExceptionMessage($exception);

            if ($config ['display']) {
                $retVal .= self::formatError($errorFullText);
            }

            if ($config ['send']) {
                self::send($errorFullText);
            }

            if ($config ['write']) {
                self::write($errorFullText);
            }

        }

        return $retVal;
    }
1092337
private function _throwDispatchException( $message, $exception_code = 0 )
    {
        $exception = new \Exception( $message, $exception_code );

		if ( is_object($this->_events_manager) )
        {
            /**
             * If the event returns false -> exit and don't throw exception
             */
            if ( $this->_events_manager->fire( "dispatch:beforeException", $this, array("exception" => $exception) ) == false )
            {
                return false;
            }
		}

        throw $exception;
    }
171304
public static function message($code)
    {
        if (array_key_exists($code, self::$messages)) {
            return self::$messages[$code];
        }

        return null;
    }
1330796
public function log($message, $code = self::LOG_TYPE_INFO)
    {
        if ($this->logLevel === self::LOG_NONE) {
            return false;
        }

        /*if ($this->logger === null) {
            if ($this->logLevel === self::LOG_NORMAL && $code !== self::LOG_TYPE_DEBUG) {
                fwrite($this->logOutput, "*** " . $message['message'] . "\n");
            } else if ($this->logLevel === self::LOG_VERBOSE) {
                fwrite($this->logOutput, "** [" . strftime('%T %Y-%m-%d') . "] " . $message['message'] . "\n");
            } else {
                return false;
            }
            return true;
        } else {*/
        $extra = array();

        if (is_array($message)) {
            $extra = $message['data'];
            $message = $message['message'];
        }

        if (!isset($extra['worker'])) {
            if ($this->child > 0) {
                $extra['worker'] = $this->hostname . ':' . getmypid();
            } else {
                list($host, $pid, $queues) = explode(':', (string) $this, 3);
                $extra['worker'] = $host . ':' . $pid;
            }
        }

        if (($this->logLevel === self::LOG_NORMAL || $this->logLevel === self::LOG_VERBOSE) && $code !== self::LOG_TYPE_DEBUG) {

            if ($this->logger === null) {
                fwrite($this->logOutput, "[" . date('c') . "] " . $message . "\n");
            } else {
                switch ($code) {
                    case self::LOG_TYPE_INFO:
                        $this->logger->addInfo($message, $extra);
                        break;
                    case self::LOG_TYPE_WARNING:
                        $this->logger->addWarning($message, $extra);
                        break;
                    case self::LOG_TYPE_ERROR:
                        $this->logger->addError($message, $extra);
                        break;
                    case self::LOG_TYPE_CRITICAL:
                        $this->logger->addCritical($message, $extra);
                        break;
                    case self::LOG_TYPE_ALERT:
                        $this->logger->addAlert($message, $extra);
                }
            }



        } else if ($code === self::LOG_TYPE_DEBUG && $this->logLevel === self::LOG_VERBOSE) {
            if ($this->logger === null) {
                fwrite($this->logOutput, "[" . date('c') . "] " . $message . "\n");
            } else {
                $this->logger->addDebug($message, $extra);
            }
        } else {
            return false;
        }

         return true;
        //}
    }
997963
public function code($code = false)
    {

        if (!$code) {
            return http_response_code();
        }

        if (headers_sent()) {
            if (self::$exceptOnHeaders && (http_response_code() != $code)) {
                throw new \Exception('Headers already sent. HTTP response code cannot be changed.');
            } else {
                return;
            }
        }

        self::$code = $code;
        http_response_code(self::$code);
    }
1338904
final protected static function getNewExceptionInstance($message, $code, array $arguments = [])
    {
        $exceptionClassName = get_called_class();

        return new $exceptionClassName(
            vsprintf($message, $arguments),
            $code
        );
    }
477182
protected function addInfo($message, $code = null)
    {
        $this->adapter->add($message, $code, 'info');
        return $this;
    }
929439
protected function output($code, $message, $data = null)
    {
        $result = [
            'code'    => $code,
            'message' => $message,
            'data'    => $data,
        ];

        if (!$this->assoc) {
            $result = (object) $result;
        }

        return $result;
    }
857234
protected function response($message, $code)
  {
    Rest::response()->json([
      'status' => $message,
      'code' => $code
    ], $code);

    cancel();
  }
773570
public function display(Exception $exception, $code)
    {
        // Collect some info about the exception.
        $info = $this->info($code, $exception);

        // Is the current request an AJAX request?
        if ((boolean)($this->request instanceof Request && $this->request->wantsJson()) == true) {
            $json_object = (object)[ 'error' => [
                'type'    => 'Exception',
                'message' => $info['message'],
            ] ];

            return JsonResponse::create($json_object, $code);
        }

        // For model-not-found, use 404 errors.
        if ($exception instanceof ModelNotFoundException) {
            $code = 404;
        }

        // If there is a custom view, use that.
        if ($this->view->exists("errors.{$code}")) {
            return $this->view->make("errors.{$code}", $info)->render();
        }

        // If the configured default error view (or errors.error) exists, render that.
        if (($errorview = $this->config->get('view.error', 'errors.error')) && $this->view->exists($errorview)) {
            return $this->view->make($errorview, $info)->render();
        }

        // Last resort: simply show the error code and message.
        return new Response($this->getFallbackDisplay($code, $info['name'], $info['message']), $code);
    }
238187
protected function convertStatusCode($code, $message, \Exception $exception = null)
    {
        $messageData = json_decode($message, true);

        if (is_array($messageData) && !empty($messageData[JSONConstants::ERROR_EXCEPTION])) {
            $jsonError = $messageData[JSONConstants::ERROR_EXCEPTION];

            if (!empty($messageData[JSONConstants::ERROR_MESSAGE])
                && is_string($messageData[JSONConstants::ERROR_MESSAGE])
            ) {
                $message = $messageData[JSONConstants::ERROR_MESSAGE];
            }

            $exceptionName = '\\Dkd\\PhpCmis\\Exception\\Cmis' . ucfirst($jsonError) . 'Exception';

            if (class_exists($exceptionName)) {
                return new $exceptionName($message, null, $exception);
            }
        }

        if (empty($message) && $exception !== null) {
            $message = $exception->getMessage();
        }

        // fall back to status code
        switch ($code) {
            case 301:
            case 302:
            case 303:
            case 307:
                return new CmisConnectionException(
                    'Redirects are not supported (HTTP status code ' . $code . '): ' . $message,
                    null,
                    $exception
                );
            case 400:
                return new CmisInvalidArgumentException($message, null, $exception);
            case 401:
                return new CmisUnauthorizedException($message, null, $exception);
            case 403:
                return new CmisPermissionDeniedException($message, null, $exception);
            case 404:
                return new CmisObjectNotFoundException($message, null, $exception);
            case 405:
                return new CmisNotSupportedException($message, null, $exception);
            case 407:
                return new CmisProxyAuthenticationException($message, null, $exception);
            case 409:
                return new CmisConstraintException($message, null, $exception);
            default:
                return new CmisRuntimeException($message, null, $exception);
        }
    }
927542
public static function codeResponse($code,$message)
    {
        $code = intval($code);

        foreach(self::$results as $v) {
            if ($v['message'] == $message && $v['code'] == $code)
                return $v;
        }

        return null;
    }
89810
public static function status(
    /*int*/ $code,
    /*string*/ $message = null
  ) {
    // General header as response.
    $header =
      @intval($code) .
      (!$message ? '' : ' ' . $message);

    // Send status for both CGI and non-CGI web servers.
    header(self::getProtocol() . ' ' . $header);
    header('Status: ' . $header);
  }
394185
protected function _createI18nException($message, $code = 0, \Exception $previous = null)
    {
        return new I18nException($message, $code, $previous);
    }
1080536
public static function getMessageFromCode($code)
    {
        if (!array_key_exists($code, self::$responseCodes)) {
            throw new \Exception('The header code '.$code.' is not valid.');
        }

        return self::$responseCodes[$code];
    }