Returns 409 Conflict Response

@param string $msg
@param int $errorCode
@param array $headers
@return json
977453
public function conflict($msg = '', $errorCode = null, $headers = [])
    {
        return $this->getErrorResponse($msg, $errorCode, self::HTTP_CONFLICT, $headers);
    }
640504
public static function singleErrorResponse( $status, $message, array $notes=array(), array $headers=array() ) {
		return self::multiErrorResponse($status, array(self::errorStructure( $message, $notes )), $headers);
	}
572861
public function api($code, $msg = '', $data = '', $header = [], $options = [])
    {
        $this->json([
            'code' => $code,
            'msg' => $msg,
            'data' => $data
        ], $header, $options);
    }
372850
public function sendError($code = 204, $vars = null, $headers = [])
    {
        $languageKey = $code . '_' . error_code_string($code);

        $error = [
            'code'    => $code,
            'title'   => language()->getLine($languageKey . '_TITLE'),
            'message' => language()->getLine($languageKey . '_MESSAGE'),
        ];

        $this->statusCode = $code;
        $this->reasonPhrase = $error[ 'title' ];

        if (is_string($vars)) {
            $vars = ['message' => $vars];
        } elseif (is_array($vars) and empty($vars[ 'message' ])) {
            $vars[ 'message' ] = $error[ 'message' ];
        }

        if (isset($vars[ 'message' ])) {
            $error[ 'message' ] = $vars[ 'message' ];
        }

        if (is_ajax() or $this->mimeType !== 'text/html') {
            $this->statusCode = $code;
            $this->reasonPhrase = $error[ 'title' ];
            $this->send($vars);

            exit(EXIT_ERROR);
        }

        $this->sendHeaders($headers);

        if (services()->has('presenter')) {
            presenter()->initialize();

            if (presenter()->theme) {
                presenter()->theme->load();
            }

            $vars = presenter()->getArrayCopy();
            extract($vars);
        }

        extract($error);

        ob_start();
        include $this->getFilePath('error-code');
        $htmlOutput = ob_get_contents();
        ob_end_clean();

        if (services()->has('presenter')) {
            $htmlOutput = presenter()->assets->parseSourceCode($htmlOutput);
        }

        echo $htmlOutput;
        exit(EXIT_ERROR);
    }
41836
public function response_json($code, $msg, $data, $http_num = 200)
    {

        return response()->json([
            'error' => $code,
            'msg' => $msg,
            'data' => $data,
        ], $http_num);
    }
692845
protected function responseError($body, $httpCode)
    {
        return $this->parseResponse($body) ?: $this->jsonError($body, $httpCode);
    }
292417
protected function result($data, $code = 0, $msg = '')
    {
        $result = [
            'code' => $code,
            'msg'  => $msg,
            'time' => Request::instance()->server('REQUEST_TIME'),
            'data' => $data,
        ];
        header('Content-type: application/json; charset=utf-8');
        die(json_encode($result));
    }
573486
protected function respondWithErrorMessage($headers = [])
    {
        $reponse = [];
        $response['success'] = false;


        if ($this->getErrorCode() !== null) {
            $response['error_code'] = (int) $this->getErrorCode();
        }

        if (is_string($this->getErrorMessage()) && $this->getErrorMessage() !== '') {
            $response['error'] = $this->getErrorMessage();
        } else if (is_array($this->getErrorMessage()) && !empty($this->getErrorMessage())) {
            $response['errors'] = $this->getErrorMessage();
        }

        return $this->respond($response, $headers);
    }
838722
protected function error($msg = '', $url = '', $data = '', $wait = 3, $header = [])
    {
        $this->jump(CodeConstant::CODE_ERROR, $msg, $url, $data, $wait, $header);
    }
148320
protected static function fail(
        int $errorCode = ErrorCodes::INVALID_VALUE,
        string $messageTemplate = Messages::INVALID_VALUE,
        array $messageParams = []
    ): RuleInterface {
        return new Fail($errorCode, $messageTemplate, $messageParams);
    }
419657
public static function getCodeByMessage(string $errorMessage): int
    {
        $code = array_search($errorMessage, self::MESSAGES);
        if ($code === false) {
            $code = self::UNKNOWN_ERROR;
        }
        return (int)$code;
    }
1033078
public function createResponse($statusCode, array $headers = [], array $options = [])
    {
        $body = JsonRpc\json_encode($options);

        return new Response($statusCode, $headers, $body === false ? null : $body);
    }
1037520
protected function createJsonBadRequestResponse(array $errors = array())
    {
        // try to extract proper validation errors
        foreach ($errors as $key => $error) {
            if (!$error instanceof FormError) {
                continue;
            }
            $errors['errors'][$key] = array(
                'message'    => $error->getMessage(),
                'parameters' => $error->getMessageParameters(),
            );
            unset($errors[$key]);
        }

        $response = new Response(
            is_string($errors) ? $errors : json_encode($errors),
            400
        );

        $response->headers->set('Content-Type', 'application/json');

        return $response;
    }
873351
public function withError($message, $errorCode, array $headers = [])
    {
        return $this->withArray([
                'error' => [
                    'code' => $errorCode,
                    'http_code' => $this->statusCode,
                    'message' => $message
                ]
            ],
            $headers
        );
    }
262086
private function buildGlobalErrors(array $errors, $msg)
    {
        if (!empty($errors)) {
            $msg .= sprintf('%s- errors:', PHP_EOL);

            foreach ($errors as $error) {
                $msg .= sprintf('%s  - %s', PHP_EOL, $error);
            }
        }

        return $msg;
    }
291784
protected static function loadResult($status, $code, $message, $errors, $extras)
    {
        $Result = new static($status);

        if (! empty($code)) {
            $Result->setCode($code);
        }

        if (! empty($message)) {
            $Result->setMessage($message);
        }

        if (! empty($errors)) {
            $Result->setErrors($errors);
        }

        if (! empty($extras)) {
            $Result->setExtras($extras);
        }

        return $Result;
    }
413673
public function msgOk ($data = null, $groups = "", $message = "", $httpStatusCode = Response::HTTP_ACCEPTED)
    {
        return $this->responseOk ($data, $groups, $message, $httpStatusCode);
    }