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   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A handleFailedProcess() 0 3 1
A __construct() 0 4 1
A handleSuccessfulProcess() 0 3 1
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