Completed
Pull Request — master (#2657)
by Jeroen
06:22
created

PageRenderEvent::getRequest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 0
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 getResponse(): ?Response
45
    {
46
        return $this->response;
47
    }
48
49
    public function setResponse(Response $response): void
50
    {
51
        $this->response = $response;
52
    }
53
}
54