LoggedOutController::main()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 9
rs 10
cc 2
nc 2
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\Module\casserver\Controller;
6
7
use SimpleSAML\Configuration;
8
use SimpleSAML\XHTML\Template;
9
use Symfony\Component\HttpFoundation\Request;
10
use Symfony\Component\HttpFoundation\Response;
11
use Symfony\Component\HttpKernel\Attribute\AsController;
12
13
#[AsController]
14
class LoggedOutController
15
{
16
    /** @var \SimpleSAML\Configuration */
17
    protected Configuration $config;
18
19
    /**
20
     * Controller constructor.
21
     *
22
     * It initializes the global configuration for the controllers implemented here.
23
     *
24
     * @param \SimpleSAML\Configuration|null $config
25
     *
26
     * @throws \Exception
27
     */
28
    public function __construct(?Configuration $config = null)
29
    {
30
        $this->config = $config ?? Configuration::getInstance();
31
    }
32
33
    /**
34
     * Show Log out view.
35
     *
36
     * @param \Symfony\Component\HttpFoundation\Request $request
37
     * @return \Symfony\Component\HttpFoundation\Response
38
     * @throws \Exception
39
     */
40
    public function main(Request $request): Response
41
    {
42
        $t = new Template($this->config, 'casserver:loggedOut.twig');
43
44
        if ($request->query->has('url')) {
45
            $t->data['url'] = $request->query->get('url');
46
        }
47
48
        return $t;
49
    }
50
}
51