ExampleController::example()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\Module\examplecomposer\Controller;
6
7
use SimpleSAML\Configuration;
8
use SimpleSAML\Session;
9
use Symfony\Component\HttpFoundation\Request;
10
use Symfony\Component\HttpFoundation\Response;
11
12
/**
13
 * Controller class for the examplecomposer module.
14
 *
15
 * This class serves the different views available in the module.
16
 *
17
 * @package simplesamlphp/simplesamlphp-module-examplecomposer
18
 */
19
class ExampleController
20
{
21
    /** @var \SimpleSAML\Configuration */
22
    protected Configuration $config;
23
24
    /** @var \SimpleSAML\Session */
25
    protected Session $session;
26
27
28
    /**
29
     * Controller constructor.
30
     *
31
     * It initializes the global configuration and session for the controllers implemented here.
32
     *
33
     * @param \SimpleSAML\Configuration $config The configuration to use by the controllers.
34
     * @param \SimpleSAML\Session $session The session to use by the controllers.
35
     *
36
     * @throws \Exception
37
     */
38
    public function __construct(
39
        Configuration $config,
40
        Session $session,
41
    ) {
42
        $this->config = $config;
43
        $this->session = $session;
44
    }
45
46
47
    /**
48
     * Say hello to the world
49
     *
50
     * @param \Symfony\Component\HttpFoundation\Request $request
51
     * @return \Symfony\Component\HttpFoundation\Response
52
     */
53
    public function example(Request $request): Response
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

53
    public function example(/** @scrutinizer ignore-unused */ Request $request): Response

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
54
    {
55
        $response = new Response(
56
            'Hello World!',
57
            Response::HTTP_OK,
58
            ['content-type' => 'text/plain'],
59
        );
60
61
        return $response;
62
    }
63
}
64