1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @author Alex Bilbie <[email protected]> |
5
|
|
|
* @copyright Copyright (c) Alex Bilbie |
6
|
|
|
* @license http://mit-license.org/ |
7
|
|
|
* |
8
|
|
|
* @link https://github.com/thephpleague/oauth2-server |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace League\OAuth2\Server\Event; |
12
|
|
|
|
13
|
|
|
use Psr\EventDispatcher\StoppableEventInterface; |
14
|
|
|
use Psr\Http\Message\ServerRequestInterface; |
15
|
|
|
|
16
|
|
|
class RequestEvent implements StoppableEventInterface |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* @var ServerRequestInterface |
20
|
|
|
*/ |
21
|
|
|
private $request; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var bool |
25
|
|
|
*/ |
26
|
|
|
protected $isPropagationStopped = false; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* RequestEvent constructor. |
30
|
|
|
* |
31
|
|
|
* @param string $name |
|
|
|
|
32
|
|
|
* @param ServerRequestInterface $request |
33
|
|
|
*/ |
34
|
30 |
|
public function __construct(ServerRequestInterface $request) |
35
|
|
|
{ |
36
|
30 |
|
$this->request = $request; |
37
|
30 |
|
} |
38
|
|
|
|
39
|
|
|
public function stopPropagation() |
40
|
|
|
{ |
41
|
|
|
$this->isPropagationStopped = true; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
public function isPropagationStopped(): bool |
45
|
|
|
{ |
46
|
|
|
return $this->isPropagationStopped; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @return ServerRequestInterface |
51
|
|
|
* @codeCoverageIgnore |
52
|
|
|
*/ |
53
|
|
|
public function getRequest() |
54
|
|
|
{ |
55
|
|
|
return $this->request; |
56
|
|
|
} |
57
|
|
|
|
58
|
13 |
|
public static function clientAuthenticationFailed(ServerRequestInterface $request): self |
59
|
|
|
{ |
60
|
13 |
|
return new ClientAuthenticationFailedEvent($request); |
61
|
|
|
} |
62
|
|
|
|
63
|
15 |
|
public static function accessTokenIssued(ServerRequestInterface $request): self |
64
|
|
|
{ |
65
|
15 |
|
return new AccessTokenIssuedEvent($request); |
66
|
|
|
} |
67
|
|
|
|
68
|
1 |
|
public static function userAuthenticationFailed(ServerRequestInterface $request): self |
69
|
|
|
{ |
70
|
1 |
|
return new UserAuthenticationFailedEvent($request); |
71
|
|
|
} |
72
|
|
|
|
73
|
7 |
|
public static function refreshTokenIssued(ServerRequestInterface $request): self |
74
|
|
|
{ |
75
|
7 |
|
return new RefreshTokenIssuedEvent($request); |
76
|
|
|
} |
77
|
|
|
|
78
|
1 |
|
public static function refreshTokenClientFailed(ServerRequestInterface $request): self |
79
|
|
|
{ |
80
|
1 |
|
return new RefreshTokenClientFailedEvent($request); |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.