Controller   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 0
dl 0
loc 38
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setRequest() 0 4 1
A setResponse() 0 4 1
1
<?php
2
/**
3
 * @file
4
 * Contains \NotAFramework\App\Controllers\Controller.
5
 */
6
7
namespace NotAFramework\App\Controllers;
8
9
use Symfony\Component\HttpFoundation\Request;
10
use Symfony\Component\HttpFoundation\Response;
11
12
abstract class Controller
13
{
14
    /**
15
     * The HTTP request object.
16
     *
17
     * @var Request
18
     */
19
    protected $request;
20
21
    /**
22
     * The HTTP response object.
23
     *
24
     * @var Response
25
     */
26
    protected $response;
27
28
    /**
29
     * Set the request object.
30
     *
31
     * @param Request $request
32
     *   HTTP request object.
33
     */
34
    public function setRequest(Request $request)
0 ignored issues
show
Bug introduced by
You have injected the Request via parameter $request. This is generally not recommended as there might be multiple instances during a request cycle (f.e. when using sub-requests). Instead, it is recommended to inject the RequestStack and retrieve the current request each time you need it via getCurrentRequest().
Loading history...
35
    {
36
        $this->request = $request;
37
    }
38
39
    /**
40
     * Set the response object.
41
     *
42
     * @param Response $response
43
     *   HTTP response object.
44
     */
45
    public function setResponse(Response $response)
46
    {
47
        $this->response = $response;
48
    }
49
}
50