TestController::testErrorPageAction()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
/*
3
 * (c) webfactory GmbH <[email protected]>
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace Webfactory\Bundle\ExceptionsBundle\Controller;
10
11
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
12
use Symfony\Component\HttpKernel\Exception\HttpException;
13
14
/**
15
 * Controller to render your custom exception pages. Accessing it is really simple, e.g. a call to .../405/html will
16
 * render your 405 HTML error page.
17
 */
18
class TestController extends Controller
0 ignored issues
show
Deprecated Code introduced by
The class Symfony\Bundle\Framework...e\Controller\Controller has been deprecated with message: since Symfony 4.2, use "Symfony\Bundle\FrameworkBundle\Controller\AbstractController" instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
19
{
20
    /**
21
     * Let the error page for the HTTP status code $code be rendered in the format $format.
22
     *
23
     * @param int $code HTTP error status code
24
     * @throws \Symfony\Component\HttpKernel\Exception\HttpException
25
     */
26
    public function testErrorPageAction($code)
27
    {
28
        $exceptionController = $this->get('twig.controller.exception');
29
30
        if ($exceptionController instanceof ExceptionController) {
31
            $exceptionController->setDebug(false);
32
        }
33
34
        throw new HttpException($code);
35
    }
36
}
37