TokenController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A user() 0 3 1
A token() 0 7 1
1
<?php
2
3
namespace App\Controller;
4
5
use Awurth\Slim\Helper\Controller\RestController;
6
use Chadicus\Slim\OAuth2\Http\RequestBridge;
7
use Chadicus\Slim\OAuth2\Http\ResponseBridge;
8
use Slim\Http\Request;
9
use Slim\Http\Response;
10
11
class TokenController extends RestController
12
{
13
    public function token(Request $request)
14
    {
15
        $oauthRequest = RequestBridge::toOAuth2($request);
16
17
        $oauthResponse = $this->oauth->handleTokenRequest($oauthRequest);
0 ignored issues
show
Bug Best Practice introduced by
The property oauth does not exist on App\Controller\TokenController. Since you implemented __get, consider adding a @property annotation.
Loading history...
18
19
        return ResponseBridge::fromOauth2($oauthResponse);
20
    }
21
22
    public function user(Request $request, Response $response)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

22
    public function user(/** @scrutinizer ignore-unused */ Request $request, Response $response)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
23
    {
24
        return $this->ok($response, $this->sentinel->getUser());
0 ignored issues
show
Bug Best Practice introduced by
The property sentinel does not exist on App\Controller\TokenController. Since you implemented __get, consider adding a @property annotation.
Loading history...
25
    }
26
}
27