Completed
Pull Request — master (#2657)
by Jeroen
05:53
created

PageRenderEvent   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 1
dl 0
loc 48
ccs 0
cts 30
cp 0
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getRequest() 0 4 1
A getPage() 0 4 1
A getRenderContext() 0 4 1
A setRenderContext() 0 4 1
A getResponse() 0 4 1
A setResponse() 0 4 1
1
<?php
2
3
namespace Kunstmaan\NodeBundle\Event;
4
5
use Kunstmaan\NodeBundle\Entity\PageInterface;
6
use Kunstmaan\NodeBundle\Helper\RenderContext;
7
use Symfony\Component\EventDispatcher\Event;
8
use Symfony\Component\HttpFoundation\Request;
9
use Symfony\Component\HttpFoundation\Response;
10
11
final class PageRenderEvent extends Event
0 ignored issues
show
Deprecated Code introduced by
The class Symfony\Component\EventDispatcher\Event has been deprecated with message: since Symfony 4.3, use "Symfony\Contracts\EventDispatcher\Event" 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...
12
{
13
    /** @var Request */
14
    private $request;
15
    /** @var PageInterface */
16
    private $page;
17
    /** @var RenderContext */
18
    private $renderContext;
19
    /** @var Response|null */
20
    private $response;
21
22
    public function __construct(Request $request, PageInterface $page, RenderContext $renderContext)
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...
23
    {
24
        $this->request = $request;
25
        $this->page = $page;
26
        $this->renderContext = $renderContext;
27
    }
28
29
    public function getRequest(): Request
30
    {
31
        return $this->request;
32
    }
33
34
    public function getPage(): PageInterface
35
    {
36
        return $this->page;
37
    }
38
39
    public function getRenderContext(): RenderContext
40
    {
41
        return $this->renderContext;
42
    }
43
44
    public function setRenderContext(RenderContext $renderContext): void
45
    {
46
        $this->renderContext = $renderContext;
47
    }
48
49
    public function getResponse(): ?Response
50
    {
51
        return $this->response;
52
    }
53
54
    public function setResponse(Response $response): void
55
    {
56
        $this->response = $response;
57
    }
58
}
59