Revoke   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 39
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 8 1
1
<?php
2
3
namespace Chadicus\Slim\OAuth2\Routes;
4
5
use Chadicus\Slim\OAuth2\Http\RequestBridge;
6
use Chadicus\Slim\OAuth2\Http\ResponseBridge;
7
use Psr\Http\Message\ServerRequestInterface;
8
use Psr\Http\message\ResponseInterface;
9
use OAuth2;
10
11
/**
12
 * The revoke class.
13
 */
14
final class Revoke implements RouteCallbackInterface
15
{
16
    const ROUTE = '/revoke';
17
18
    /**
19
     * The oauth2 server instance.
20
     *
21
     * @var OAuth2\Server
22
     */
23
    private $server;
24
25
    /**
26
     * Construct a new instance of Authorize.
27
     *
28
     * @param OAuth2\Server $server The oauth2 server imstance.
29
     */
30
    public function __construct(OAuth2\Server $server)
31
    {
32
        $this->server = $server;
33
    }
34
35
    /**
36
     * Invoke this route callback.
37
     *
38
     * @param ServerRequestInterface $request   Represents the current HTTP request.
39
     * @param ResponseInterface      $response  Represents the current HTTP response.
40
     * @param array                  $arguments Values for the current route’s named placeholders.
41
     *
42
     * @return ResponseInterface
43
     */
44
    public function __invoke(ServerRequestInterface $request, ResponseInterface $response, array $arguments = [])
45
    {
46
        return ResponseBridge::fromOAuth2(
47
            $this->server->handleRevokeRequest(
48
                RequestBridge::toOAuth2($request)
49
            )
50
        );
51
    }
52
}
53