AuthorisationController   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 5
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 5
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A authAction() 0 2 1
1
<?php
2
3
namespace App\Controller;
4
5
6
use OAuth2\Request;
0 ignored issues
show
Bug introduced by
The type OAuth2\Request was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use OAuth2\Response;
0 ignored issues
show
Bug introduced by
The type OAuth2\Response was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
9
class AuthorisationController extends OAuthServerController
10
{
11
12
    public function authAction()
13
    {
14
        /*
15
        $server = $this->oauth2Server;
16
17
        $request = Request::createFromGlobals();
18
        $response = new Response();
19
20
        if (!$server->validateAuthorizeRequest($request, $response)) {
21
            $response->send();
22
            exit;
23
        }
24
25
        $form = $this->getForm();
26
27
        if (empty($_POST)) {
28
            $html = $form->render();
29
            echo $html;
30
            exit;
31
        } else {
32
            $post = $this->getRequest()->getParsedBody();
33
            $form->populate($post);
34
            if ($form->isValid()) {
35
                $data = $form->getValues();
36
                $isAuthorized = ($data['auth'] === 'yes');
37
                $server->handleAuthorizeRequest($request, $response, $isAuthorized);
38
                $code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=')+5, 40);
39
                exit("SUCCESS! Authorization Code: $code");
40
            }
41
        }
42
        $response->setStatusCode(400);
43
        $response->send();
44
        exit;
45
        */
46
    }
47
48
49
}