Completed
Pull Request — master (#1028)
by
unknown
13:06
created

RequestEvent::stopPropagation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
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\Http\Message\ServerRequestInterface;
14
use Psr\EventDispatcher\StoppableEventInterface;
15
use League\OAuth2\Server\Event\ClientAuthenticationFailedEvent;
16
use League\OAuth2\Server\Event\AccessTokenIssuedEvent;
17
use League\OAuth2\Server\Event\UserAuthenticationFailedEvent;
18
use League\OAuth2\Server\Event\RefreshTokenIssuedEvent;
19
use League\OAuth2\Server\Event\RefreshTokenClientFailedEvent;
20
21
class RequestEvent implements StoppableEventInterface
22
{
23
24
    /**
25
     * @var ServerRequestInterface
26
     */
27
    private $request;
28
29
    /**
30
     * @var bool
31
     */
32
    protected $isPropagationStopped = false;
33
34
    /**
35
     * RequestEvent constructor.
36
     *
37
     * @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...
38
     * @param ServerRequestInterface $request
39
     */
40 30
    public function __construct(ServerRequestInterface $request)
41
    {
42 30
        $this->request = $request;
43 30
    }
44
45
    public function stopPropagation()
46
    {
47
        $this->isPropagationStopped = true;
48
    }
49
50
    public function isPropagationStopped(): bool
51
    {
52
        return $this->isPropagationStopped;
53
    }
54
55
    /**
56
     * @return ServerRequestInterface
57
     * @codeCoverageIgnore
58
     */
59
    public function getRequest()
60
    {
61
        return $this->request;
62
    }
63
64 13
    public static function clientAuthenticationFailed(ServerRequestInterface $request): self
65
    {
66 13
        return new ClientAuthenticationFailedEvent($request);
67
    }
68
69 15
    public static function accessTokenIssued(ServerRequestInterface $request): self
70
    {
71 15
        return new AccessTokenIssuedEvent($request);
72
    }
73
74 1
    public static function userAuthenticationFailed(ServerRequestInterface $request): self
75
    {
76 1
        return new UserAuthenticationFailedEvent($request);
77
    }
78
79 7
    public static function refreshTokenIssued(ServerRequestInterface $request): self
80
    {
81 7
        return new RefreshTokenIssuedEvent($request);
82
    }
83
84 1
    public static function refreshTokenClientFailed(ServerRequestInterface $request): self
85
    {
86 1
        return new RefreshTokenClientFailedEvent($request);
87
    }
88
89
}
90