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 Yokai\SecurityTokenBundle; |
||
4 | |||
5 | use DateTime; |
||
6 | use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
||
7 | use Yokai\SecurityTokenBundle\Entity\Token; |
||
8 | use Yokai\SecurityTokenBundle\Event\ConsumeTokenEvent; |
||
9 | use Yokai\SecurityTokenBundle\Event\CreateTokenEvent; |
||
10 | use Yokai\SecurityTokenBundle\Event\TokenAlreadyConsumedEvent; |
||
11 | use Yokai\SecurityTokenBundle\Event\TokenConsumedEvent; |
||
12 | use Yokai\SecurityTokenBundle\Event\TokenCreatedEvent; |
||
13 | use Yokai\SecurityTokenBundle\Event\TokenExpiredEvent; |
||
14 | use Yokai\SecurityTokenBundle\Event\TokenNotFoundEvent; |
||
15 | use Yokai\SecurityTokenBundle\Event\TokenRetrievedEvent; |
||
16 | use Yokai\SecurityTokenBundle\Event\TokenTotallyConsumedEvent; |
||
17 | use Yokai\SecurityTokenBundle\Event\TokenUsedEvent; |
||
18 | |||
19 | /** |
||
20 | * @author Yann Eugoné <[email protected]> |
||
21 | */ |
||
22 | class EventDispatcher |
||
23 | { |
||
24 | /** |
||
25 | * @var EventDispatcherInterface |
||
26 | */ |
||
27 | private $eventDispatcher; |
||
28 | |||
29 | /** |
||
30 | * @param EventDispatcherInterface $eventDispatcher |
||
31 | */ |
||
32 | 7 | public function __construct(EventDispatcherInterface $eventDispatcher) |
|
33 | { |
||
34 | 7 | $this->eventDispatcher = $eventDispatcher; |
|
35 | 7 | } |
|
36 | |||
37 | /** |
||
38 | * @param string $purpose |
||
39 | * @param string $value |
||
40 | * @param array $payload |
||
41 | * |
||
42 | * @return CreateTokenEvent |
||
43 | */ |
||
44 | 1 | public function createToken($purpose, $value, array $payload) |
|
45 | { |
||
46 | 1 | $this->eventDispatcher->dispatch( |
|
47 | 1 | TokenEvents::CREATE_TOKEN, |
|
48 | 1 | $event = new CreateTokenEvent($purpose, $value, $payload) |
|
0 ignored issues
–
show
|
|||
49 | ); |
||
50 | |||
51 | 1 | return $event; |
|
52 | } |
||
53 | |||
54 | /** |
||
55 | * @param Token $token |
||
56 | * |
||
57 | * @return TokenCreatedEvent |
||
58 | */ |
||
59 | 1 | public function tokenCreated(Token $token) |
|
60 | { |
||
61 | 1 | $this->eventDispatcher->dispatch( |
|
62 | 1 | TokenEvents::TOKEN_CREATED, |
|
63 | 1 | $event = new TokenCreatedEvent($token) |
|
0 ignored issues
–
show
$event = new \Yokai\Secu...kenCreatedEvent($token) is of type object<Yokai\SecurityTok...vent\TokenCreatedEvent> , but the function expects a null|string .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
64 | ); |
||
65 | |||
66 | 1 | return $event; |
|
67 | } |
||
68 | |||
69 | /** |
||
70 | * @param Token $token |
||
71 | * @param DateTime|null $at |
||
72 | * @param array $information |
||
73 | * |
||
74 | * @return ConsumeTokenEvent |
||
75 | */ |
||
76 | 1 | public function consumeToken(Token $token, DateTime $at = null, array $information = []) |
|
77 | { |
||
78 | 1 | $this->eventDispatcher->dispatch( |
|
79 | 1 | TokenEvents::CONSUME_TOKEN, |
|
80 | 1 | $event = new ConsumeTokenEvent($token, $at, $information) |
|
0 ignored issues
–
show
$event = new \Yokai\Secu...ken, $at, $information) is of type object<Yokai\SecurityTok...vent\ConsumeTokenEvent> , but the function expects a null|string .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
81 | ); |
||
82 | |||
83 | 1 | return $event; |
|
84 | } |
||
85 | |||
86 | /** |
||
87 | * @param Token $token |
||
88 | * |
||
89 | * @return TokenConsumedEvent |
||
90 | */ |
||
91 | 1 | public function tokenConsumed(Token $token) |
|
92 | { |
||
93 | 1 | $this->eventDispatcher->dispatch( |
|
94 | 1 | TokenEvents::TOKEN_CONSUMED, |
|
95 | 1 | $event = new TokenConsumedEvent($token) |
|
0 ignored issues
–
show
$event = new \Yokai\Secu...enConsumedEvent($token) is of type object<Yokai\SecurityTok...ent\TokenConsumedEvent> , but the function expects a null|string .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
96 | ); |
||
97 | |||
98 | 1 | return $event; |
|
99 | } |
||
100 | |||
101 | /** |
||
102 | * @param Token $token |
||
103 | * |
||
104 | * @return TokenTotallyConsumedEvent |
||
105 | */ |
||
106 | 1 | public function tokenTotallyConsumed(Token $token) |
|
107 | { |
||
108 | 1 | $this->eventDispatcher->dispatch( |
|
109 | 1 | TokenEvents::TOKEN_TOTALLY_CONSUMED, |
|
110 | 1 | $event = new TokenTotallyConsumedEvent($token) |
|
0 ignored issues
–
show
$event = new \Yokai\Secu...lyConsumedEvent($token) is of type object<Yokai\SecurityTok...enTotallyConsumedEvent> , but the function expects a null|string .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
111 | ); |
||
112 | |||
113 | 1 | return $event; |
|
114 | } |
||
115 | |||
116 | /** |
||
117 | * @param string $purpose |
||
118 | * @param string $value |
||
119 | * |
||
120 | * @return TokenNotFoundEvent |
||
121 | */ |
||
122 | 1 | public function tokenNotFound($purpose, $value) |
|
123 | { |
||
124 | 1 | $this->eventDispatcher->dispatch( |
|
125 | 1 | TokenEvents::TOKEN_NOT_FOUND, |
|
126 | 1 | $event = new TokenNotFoundEvent($purpose, $value) |
|
0 ignored issues
–
show
$event = new \Yokai\Secu...Event($purpose, $value) is of type object<Yokai\SecurityTok...ent\TokenNotFoundEvent> , but the function expects a null|string .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
127 | ); |
||
128 | |||
129 | 1 | return $event; |
|
130 | } |
||
131 | |||
132 | /** |
||
133 | * @param string $purpose |
||
134 | * @param string $value |
||
135 | * |
||
136 | * @return TokenExpiredEvent |
||
137 | */ |
||
138 | 1 | public function tokenExpired($purpose, $value) |
|
139 | { |
||
140 | 1 | $this->eventDispatcher->dispatch( |
|
141 | 1 | TokenEvents::TOKEN_EXPIRED, |
|
142 | 1 | $event = new TokenExpiredEvent($purpose, $value) |
|
0 ignored issues
–
show
$event = new \Yokai\Secu...Event($purpose, $value) is of type object<Yokai\SecurityTok...vent\TokenExpiredEvent> , but the function expects a null|string .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
143 | ); |
||
144 | |||
145 | 1 | return $event; |
|
146 | } |
||
147 | |||
148 | /** |
||
149 | * @deprecated since 2.3 to be removed in 3.0. Use tokenAlreadyConsumed instead. |
||
150 | * @param string $purpose |
||
151 | * @param string $value |
||
152 | * |
||
153 | * @return TokenUsedEvent |
||
154 | */ |
||
155 | public function tokenUsed($purpose, $value) |
||
156 | { |
||
157 | @trigger_error( |
||
0 ignored issues
–
show
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.
If you suppress an error, we recommend checking for the error condition explicitly: // For example instead of
@mkdir($dir);
// Better use
if (@mkdir($dir) === false) {
throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
![]() |
|||
158 | __METHOD__.' is deprecated. Use '.__CLASS__.'::tokenAlreadyConsumed instead.' |
||
159 | ); |
||
160 | |||
161 | return $this->tokenAlreadyConsumed($purpose, $value); |
||
162 | } |
||
163 | |||
164 | /** |
||
165 | * @param string $purpose |
||
166 | * @param string $value |
||
167 | * |
||
168 | * @return TokenAlreadyConsumedEvent |
||
169 | */ |
||
170 | 1 | public function tokenAlreadyConsumed($purpose, $value) |
|
171 | { |
||
172 | 1 | $this->eventDispatcher->dispatch( |
|
173 | 1 | TokenEvents::TOKEN_ALREADY_CONSUMED, |
|
174 | 1 | $event = new TokenAlreadyConsumedEvent($purpose, $value) |
|
0 ignored issues
–
show
$event = new \Yokai\Secu...Event($purpose, $value) is of type object<Yokai\SecurityTok...enAlreadyConsumedEvent> , but the function expects a null|string .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
175 | ); |
||
176 | |||
177 | 1 | return $event; |
|
178 | } |
||
179 | |||
180 | /** |
||
181 | * @param Token $token |
||
182 | * |
||
183 | * @return TokenRetrievedEvent |
||
184 | */ |
||
185 | 1 | public function tokenRetrieved(Token $token) |
|
186 | { |
||
187 | 1 | $this->eventDispatcher->dispatch( |
|
188 | 1 | TokenEvents::TOKEN_RETRIEVED, |
|
189 | 1 | $event = new TokenRetrievedEvent($token) |
|
0 ignored issues
–
show
$event = new \Yokai\Secu...nRetrievedEvent($token) is of type object<Yokai\SecurityTok...nt\TokenRetrievedEvent> , but the function expects a null|string .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
190 | ); |
||
191 | |||
192 | 1 | return $event; |
|
193 | } |
||
194 | } |
||
195 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: