OAuthAuthorizeController::authorize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace App\Authorization\Controller;
4
5
use FOS\OAuthServerBundle\Controller\AuthorizeController;
6
use Nelmio\ApiDocBundle\Annotation\Operation;
7
use Swagger\Annotations as SWG;
8
use Symfony\Component\HttpFoundation\JsonResponse;
9
use Symfony\Component\HttpFoundation\Request;
10
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
11
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
12
13
/**
14
 * Class OAuthAuthorizeController
15
 * @package App\Authorize\Controller
16
 *
17
 * {@inheritdoc}
18
 */
19
class OAuthAuthorizeController extends AuthorizeController {
20
    /**
21
     * Authorize user
22
     *
23
     * @Route("/oauth/v2/auth")
24
     * @Method({"POST","GET"})
25
     *
26
     * @Operation(
27
     *     tags={"OAuth"},
28
     *     summary="Authorize user",
29
     *     @SWG\Parameter(
30
     *         name="redirect_uri",
31
     *         in="formData",
32
     *         description="The redirect URI registered by the client",
33
     *         required=false,
34
     *         type="string"
35
     *     ),
36
     *     @SWG\Parameter(
37
     *         name="scope",
38
     *         in="formData",
39
     *         description="The scope of the authorization",
40
     *         required=false,
41
     *         type="string"
42
     *     ),
43
     *     @SWG\Parameter(
44
     *         name="state",
45
     *         in="formData",
46
     *         description="Any client state that needs to be passed on to the client request URI",
47
     *         required=false,
48
     *         type="string"
49
     *     ),
50
     *     @SWG\Response(
51
     *         response="200",
52
     *         description="Returned when successful"
53
     *     )
54
     * )
55
     * @param Request $request
56
     * @return \Symfony\Component\HttpFoundation\Response
57
     */
58
    public function authorize(Request $request)
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

58
    public function authorize(/** @scrutinizer ignore-unused */ Request $request)

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...
59
    {
60
        return new JsonResponse(['test']);
61
        return parent::authorizeAction($request);
0 ignored issues
show
Unused Code introduced by
return parent::authorizeAction($request) is not reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
62
    }
63
}
64