Passed
Push — master ( 81b6b5...5b35ab )
by Tim
03:44
created

LoggedOutController::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
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   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   Request  $request
37
     * @return Response
38
     * @throws \Exception
39
     */
40
    public function main(Request $request): Response
41
    {
42
        $t = new Template($this->config, 'casserver:loggedOut.twig');
43
        if ($request->query->has('url')) {
44
            $t->data['url'] = $request->query->get('url');
45
        }
46
        return $t;
47
    }
48
}
49