This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\RedirectBundle\Entity; |
||
4 | |||
5 | use Doctrine\ORM\Mapping as ORM; |
||
6 | use Kunstmaan\AdminBundle\Entity\AbstractEntity; |
||
7 | use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; |
||
8 | use Symfony\Component\Validator\Constraints as Assert; |
||
9 | use Symfony\Component\Validator\Context\ExecutionContextInterface; |
||
10 | |||
11 | /** |
||
12 | * @ORM\Table( |
||
13 | * name="kuma_redirects", |
||
14 | * uniqueConstraints={ |
||
15 | * @ORM\UniqueConstraint(name="kuma_redirects_idx_domain_origin", columns={"domain", "origin"}) |
||
16 | * } |
||
17 | * ) |
||
18 | * @ORM\Entity(repositoryClass="Kunstmaan\RedirectBundle\Repository\RedirectRepository") |
||
19 | * @UniqueEntity(fields={"origin", "domain"}) |
||
20 | */ |
||
21 | class Redirect extends AbstractEntity |
||
22 | { |
||
23 | /** |
||
24 | * @var string |
||
25 | * |
||
26 | * @ORM\Column(name="domain", type="string", length=255, nullable=true) |
||
27 | */ |
||
28 | private $domain; |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | * |
||
33 | * @ORM\Column(name="origin", type="string", length=255) |
||
34 | * @Assert\NotBlank() |
||
35 | */ |
||
36 | private $origin; |
||
37 | |||
38 | /** |
||
39 | * @var string |
||
40 | * |
||
41 | * @ORM\Column(name="note", type="string", length=255, nullable=true) |
||
42 | */ |
||
43 | private $note; |
||
44 | |||
45 | /** |
||
46 | * @var string |
||
47 | * |
||
48 | * @ORM\Column(name="target", type="text") |
||
49 | * @Assert\NotBlank() |
||
50 | */ |
||
51 | private $target; |
||
52 | |||
53 | /** |
||
54 | * @var bool |
||
55 | * |
||
56 | * @ORM\Column(name="permanent", type="boolean") |
||
57 | */ |
||
58 | private $permanent; |
||
59 | |||
60 | /** |
||
61 | * Get domain |
||
62 | * |
||
63 | * @return string |
||
64 | */ |
||
65 | 4 | public function getDomain() |
|
66 | { |
||
67 | 4 | return $this->domain; |
|
68 | } |
||
69 | |||
70 | /** |
||
71 | * Set domain |
||
72 | * |
||
73 | * @param string $domain |
||
74 | * |
||
75 | * @return Redirect |
||
76 | */ |
||
77 | 6 | public function setDomain($domain) |
|
78 | { |
||
79 | 6 | $this->domain = $domain; |
|
80 | |||
81 | 6 | return $this; |
|
82 | } |
||
83 | |||
84 | /** |
||
85 | * Set origin |
||
86 | * |
||
87 | * @param string $origin |
||
88 | * |
||
89 | * @return Redirect |
||
90 | */ |
||
91 | 8 | public function setOrigin($origin) |
|
92 | { |
||
93 | 8 | $this->origin = $origin; |
|
94 | |||
95 | 8 | return $this; |
|
96 | } |
||
97 | |||
98 | /** |
||
99 | * Get origin |
||
100 | * |
||
101 | * @return string |
||
102 | */ |
||
103 | 6 | public function getOrigin() |
|
104 | { |
||
105 | 6 | return $this->origin; |
|
106 | } |
||
107 | |||
108 | /** |
||
109 | * Set target |
||
110 | * |
||
111 | * @param string $target |
||
112 | * |
||
113 | * @return Redirect |
||
114 | */ |
||
115 | 8 | public function setTarget($target) |
|
116 | { |
||
117 | 8 | $this->target = $target; |
|
118 | |||
119 | 8 | return $this; |
|
120 | } |
||
121 | |||
122 | /** |
||
123 | * Get target |
||
124 | * |
||
125 | * @return string |
||
126 | */ |
||
127 | 6 | public function getTarget() |
|
128 | { |
||
129 | 6 | return $this->target; |
|
130 | } |
||
131 | |||
132 | /** |
||
133 | * Set permanent |
||
134 | * |
||
135 | * @param bool $permanent |
||
136 | * |
||
137 | * @return Redirect |
||
138 | */ |
||
139 | 6 | public function setPermanent($permanent) |
|
140 | { |
||
141 | 6 | $this->permanent = $permanent; |
|
142 | |||
143 | 6 | return $this; |
|
144 | } |
||
145 | |||
146 | /** |
||
147 | * Get permanent |
||
148 | * |
||
149 | * @return bool |
||
150 | */ |
||
151 | 4 | public function isPermanent() |
|
152 | { |
||
153 | 4 | return $this->permanent; |
|
154 | } |
||
155 | |||
156 | /** |
||
157 | * @return string |
||
158 | */ |
||
159 | public function getNote() |
||
160 | { |
||
161 | return $this->note; |
||
162 | } |
||
163 | |||
164 | /** |
||
165 | * @param string $note |
||
166 | * |
||
167 | * @return Redirect |
||
0 ignored issues
–
show
|
|||
168 | */ |
||
169 | public function setNote($note) |
||
170 | { |
||
171 | $this->note = $note; |
||
172 | } |
||
173 | |||
174 | /** |
||
175 | * @Assert\Callback |
||
176 | * |
||
177 | * @param ExecutionContextInterface $context |
||
178 | */ |
||
179 | 2 | public function validate(ExecutionContextInterface $context) |
|
180 | { |
||
181 | 2 | if ($this->getOrigin() === $this->getTarget()) { |
|
182 | 1 | $context->buildViolation('errors.redirect.origin_same_as_target') |
|
183 | 1 | ->atPath('target') |
|
184 | 1 | ->addViolation(); |
|
185 | } |
||
186 | 2 | } |
|
187 | } |
||
188 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.