AdaptFormEvent::getPage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Kunstmaan\NodeBundle\Event;
4
5
use Kunstmaan\AdminBundle\Event\BcEvent;
6
use Kunstmaan\AdminBundle\Helper\FormWidgets\Tabs\TabPane;
7
use Kunstmaan\NodeBundle\Entity\HasNodeInterface;
8
use Kunstmaan\NodeBundle\Entity\Node;
9
use Kunstmaan\NodeBundle\Entity\NodeTranslation;
10
use Kunstmaan\NodeBundle\Entity\NodeVersion;
11
use Symfony\Component\HttpFoundation\Request;
12
13
/**
14
 * The event to pass metadata if the adaptForm event is triggered
15
 */
16
class AdaptFormEvent extends BcEvent
17
{
18
    /**
19
     * @var TabPane
20
     */
21
    private $tabPane;
22
23
    /**
24
     * @var
25
     */
26
    private $page;
27
28
    /**
29
     * @var Node
30
     */
31
    private $node;
32
33
    /**
34
     * @var NodeTranslation
35
     */
36
    private $nodeTranslation;
37
38
    /**
39
     * @var NodeVersion
40
     */
41
    private $nodeVersion;
42
43
    /**
44
     * @var Request
45
     */
46
    private $request;
47
48
    /**
49
     * @param Request          $request
50
     * @param TabPane          $tabPane         The tab pane
51
     * @param HasNodeInterface $page            The page
0 ignored issues
show
Documentation introduced by
Should the type for parameter $page not be HasNodeInterface|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
52
     * @param Node             $node            The node
0 ignored issues
show
Documentation introduced by
Should the type for parameter $node not be null|Node?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
53
     * @param NodeTranslation  $nodeTranslation The node translation
0 ignored issues
show
Documentation introduced by
Should the type for parameter $nodeTranslation not be null|NodeTranslation?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
54
     * @param NodeVersion      $nodeVersion     The node version
0 ignored issues
show
Documentation introduced by
Should the type for parameter $nodeVersion not be null|NodeVersion?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
55
     */
56 2
    public function __construct(Request $request, TabPane $tabPane, $page = null, Node $node = null, NodeTranslation $nodeTranslation = null, NodeVersion $nodeVersion = null)
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...
57
    {
58 2
        $this->request = $request;
59 2
        $this->tabPane = $tabPane;
60 2
        $this->page = $page;
61 2
        $this->node = $node;
62 2
        $this->nodeTranslation = $nodeTranslation;
63 2
        $this->nodeVersion = $nodeVersion;
64 2
    }
65
66
    /**
67
     * @return Node
68
     */
69 1
    public function getNode()
70
    {
71 1
        return $this->node;
72
    }
73
74
    /**
75
     * @return NodeTranslation
76
     */
77 1
    public function getNodeTranslation()
78
    {
79 1
        return $this->nodeTranslation;
80
    }
81
82
    /**
83
     * @return NodeVersion
84
     */
85 1
    public function getNodeVersion()
86
    {
87 1
        return $this->nodeVersion;
88
    }
89
90
    /**
91
     * @return
92
     */
93 2
    public function getPage()
94
    {
95 2
        return $this->page;
96
    }
97
98
    /**
99
     * @return TabPane
100
     */
101 2
    public function getTabPane()
102
    {
103 2
        return $this->tabPane;
104
    }
105
106 1
    public function getRequest()
107
    {
108 1
        return $this->request;
109
    }
110
}
111