Code Duplication    Length = 15-17 lines in 2 locations

src/Mouf/Mvc/Splash/Controllers/HttpErrorsController.php 2 locations

@@ 105-121 (lines=17) @@
102
     *
103
     * @return ResponseInterface
104
     */
105
    public function badRequest(BadRequestException $exception, ServerRequestInterface $request) : ResponseInterface
106
    {
107
        $this->exception = $exception;
108
109
        $acceptType = $request->getHeader('Accept');
110
        if (is_array($acceptType) && count($acceptType) > 0 && strpos($acceptType[0], 'json') !== false) {
111
            return new JsonResponse(['error' => ['message' => 'Bad request sent', 'type' => 'bad_request']], 400);
112
        }
113
114
        if ($this->contentFor400) {
115
            $this->contentBlock = $this->contentFor400;
116
        } else {
117
            $this->contentBlock->addFile(__DIR__.'/../../../../views/400.php', $this);
118
        }
119
120
        return HtmlResponse::create($this->template, 400);
121
    }
122
123
    /**
124
     * This function is called when a HTTP 404 error is triggered by the user.
@@ 130-144 (lines=15) @@
127
     *
128
     * @return ResponseInterface
129
     */
130
    public function pageNotFound(ServerRequestInterface $request) : ResponseInterface
131
    {
132
        $acceptType = $request->getHeader('Accept');
133
        if (is_array($acceptType) && count($acceptType) > 0 && strpos($acceptType[0], 'json') !== false) {
134
            return new JsonResponse(['error' => ['message' => 'Page not found', 'type' => 'page_not_found']], 404);
135
        }
136
137
        if ($this->contentFor404) {
138
            $this->contentBlock->addHtmlElement($this->contentFor404);
139
        } else {
140
            $this->contentBlock->addFile(__DIR__.'/../../../../views/404.php', $this);
141
        }
142
143
        return HtmlResponse::create($this->template, 404);
144
    }
145
146
    /**
147
     * (non-PHPdoc).