Completed
Pull Request — master (#1028)
by
unknown
29:34 queued 28:13
created

RequestEvent::clientAuthenticationFailed()   A

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 1
crap 1
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
    /**
20
     * @var ServerRequestInterface
21
     */
22
    private $request;
23
24
    /**
25
     * @var bool
26
     */
27
    protected $isPropagationStopped = false;
28
29
    /**
30
     * RequestEvent constructor.
31
     *
32
     * @param string                 $name
0 ignored issues
show
Bug introduced by
There is no parameter named $name. Was it maybe removed?

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 method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
33
     * @param ServerRequestInterface $request
34
     */
35 30
    public function __construct(ServerRequestInterface $request)
36
    {
37 30
        $this->request = $request;
38 30
    }
39
40
    public function stopPropagation()
41
    {
42
        $this->isPropagationStopped = true;
43
    }
44
45
    public function isPropagationStopped(): bool
46
    {
47
        return $this->isPropagationStopped;
48
    }
49
50
    /**
51
     * @return ServerRequestInterface
52
     * @codeCoverageIgnore
53
     */
54
    public function getRequest()
55
    {
56
        return $this->request;
57
    }
58
59 13
    public static function clientAuthenticationFailed(ServerRequestInterface $request): self
60
    {
61 13
        return new ClientAuthenticationFailedEvent($request);
62
    }
63
64 15
    public static function accessTokenIssued(ServerRequestInterface $request): self
65
    {
66 15
        return new AccessTokenIssuedEvent($request);
67
    }
68
69 1
    public static function userAuthenticationFailed(ServerRequestInterface $request): self
70
    {
71 1
        return new UserAuthenticationFailedEvent($request);
72
    }
73
74 7
    public static function refreshTokenIssued(ServerRequestInterface $request): self
75
    {
76 7
        return new RefreshTokenIssuedEvent($request);
77
    }
78
79 1
    public static function refreshTokenClientFailed(ServerRequestInterface $request): self
80
    {
81 1
        return new RefreshTokenClientFailedEvent($request);
82
    }
83
}
84