GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Callback::handleSuccessfulProcess()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LM\AuthAbstractor\Implementation;
6
7
use Closure;
8
use LM\AuthAbstractor\Model\IAuthenticationProcess;
9
use Psr\Http\Message\ResponseInterface;
10
use LM\AuthAbstractor\Model\IAuthenticationCallback;
11
12
/**
13
 * This is a convenience implementation of IAuthenticationCallback.
14
 *
15
 * If the callbacks you define are long, you might want to define your own
16
 * implementation of IAuthenticationCallback, for readability and reusability
17
 * purposes.
18
 *
19
 * @see \LM\AuthAbstractor\Model\IAuthenticationCallback
20
 * @todo Check closure signature?
21
 */
22
class Callback implements IAuthenticationCallback
23
{
24
    /** @var Closure */
25
    private $failureClosure;
26
27
    /** @var Closure */
28
    private $successClosure;
29
30
    /**
31
     * @api
32
     * @param Closure $failureClosure The closure to call if the authentication
33
     * process fails. It must accept an IAuthenticationProcess as an argument,
34
     * and return a ResponseInterface.
35
     * @param Closure $successClosure The closure to call if the authentication
36
     * process succeeds. It must accept an IAuthenticationProcess as an argument,
37
     * and return a ResponseInterface.
38
     */
39
    public function __construct(Closure $failureClosure, Closure $successClosure)
40
    {
41
        $this->failureClosure = $failureClosure;
42
        $this->successClosure = $successClosure;
43
    }
44
45
    public function handleFailedProcess(IAuthenticationProcess $authProcess): ResponseInterface
46
    {
47
        return ($this->failureClosure)($authProcess);
48
    }
49
50
    public function handleSuccessfulProcess(IAuthenticationProcess $authProcess): ResponseInterface
51
    {
52
        return ($this->successClosure)($authProcess);
53
    }
54
}
55