AuthCreateAction   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 8 1
1
<?php
2
3
namespace Finder\Http\Actions;
4
5
use Finder\Http\Proxy\Contracts\OAuthProxy;
6
use Finder\Http\Requests\CreateAuthRequest;
7
use Illuminate\Contracts\Routing\ResponseFactory;
8
use Illuminate\Http\Response;
9
10
/**
11
 * Class AuthCreateAction.
12
 *
13
 * @package Finder\Http\Actions
14
 */
15
class AuthCreateAction
16
{
17
    /**
18
     * @var OAuthProxy
19
     */
20
    protected $oAuthProxy;
21
22
    /**
23
     * AuthCreateAction constructor.
24
     *
25
     * @param ResponseFactory $responseFactory
0 ignored issues
show
Bug introduced by
There is no parameter named $responseFactory. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
26
     * @param OAuthProxy      $oAuthProxy
27
     */
28
    public function __construct(OAuthProxy $oAuthProxy)
29
    {
30
        $this->oAuthProxy = $oAuthProxy;
31
    }
32
33
    /**
34
     * @apiVersion        1.0.0
35
     * @api               {post} /v1/auth/token Create
36
     * @apiName           Create
37
     * @apiGroup          Auth
38
     * @apiHeader         {String} Accept application/json
39
     * @apiHeader         {String} Content-Type application/json
40
     * @apiParamExample   {json} Request-Body-Example:
41
     * {
42
     *     "email": "[email protected]",
43
     *     "password": "password"
44
     * }
45
     * @apiSuccessExample {json} Success-Response:
46
     * HTTP/1.1 204 No Content
47
     */
48
49
    /**
50
     * Create an auth token.
51
     *
52
     * @param  CreateAuthRequest $request
53
     * @return Response
54
     */
55
    public function __invoke(CreateAuthRequest $request)
56
    {
57
        return $this->oAuthProxy->requestTokenByCredentials(
58
            env('OAUTH_CLIENT_ID'),
59
            $request->input('email'),
60
            $request->input('password')
61
        );
62
    }
63
}
64