Completed
Branch develop (6fd611)
by Quentin
02:32
created

TokenApiController   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A postAction() 0 18 1
1
<?php
2
3
namespace Majora\Bundle\OAuthServerBundle\Controller;
4
5
use Majora\Bundle\FrameworkExtraBundle\Controller\RestApiControllerTrait;
6
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7
use Symfony\Component\HttpFoundation\Request;
8
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
9
10
/**
11
 * Controller for oAuth tokens web cases.
12
 */
13
class TokenApiController extends Controller
14
{
15
    use RestApiControllerTrait;
16
17
    /**
18
     * Create a new access_token from given request throught oAuth server.
19
     *
20
     * @param Request $request
21
     *
22
     * @return Response
23
     */
24
    public function postAction(Request $request)
25
    {
26
        // UndefinedOptionsException
27
        // MissingOptionsException
28
29
        // $badRequestException = $this->createJsonBadRequestResponse();
0 ignored issues
show
Unused Code Comprehensibility introduced by
55% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
30
        // $accessDeniedException = new AccessDeniedHttpException();
0 ignored issues
show
Unused Code Comprehensibility introduced by
46% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
31
32
        // try {
33
            $accessToken = $this->get('oauth.server')->grant(
34
                $this->getRequestData($request, 'snakelize')
35
            );
36
        // } catch (\Exception $e) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
37
38
        // }
39
40
        return $this->createJsonResponse($accessToken);
41
    }
42
}
43