RequestIdController::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 6
Ratio 100 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 6
loc 6
ccs 4
cts 4
cp 1
crap 1
rs 9.4285
1
<?php
2
3
namespace Sausin\Signere\Http\Controllers\Admin;
4
5
use Illuminate\Http\Request;
6
use Sausin\Signere\RequestId;
7
use Sausin\Signere\Http\Controllers\Controller;
8
9 View Code Duplication
class RequestIdController extends Controller
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
10
{
11
    /** @var \Sausin\Signere\RequestId */
12
    protected $signereRequest;
13
14
    /**
15
     * Create a new controller instance.
16
     *
17
     * @param  \Sausin\Signere\RequestId $signereRequest
18
     */
19 1
    public function __construct(RequestId $signereRequest)
20
    {
21 1
        parent::__construct();
22
23 1
        $this->signereRequest = $signereRequest;
24 1
    }
25
26
    /**
27
     * Retrives a SignereID session to get the
28
     * information about the authorized user.
29
     *
30
     * @return \Illuminate\Http\Response
31
     */
32 1
    public function __invoke(Request $request)
33
    {
34 1
        $this->validate($request, [
35 1
            'request_id' => 'required|string',
36
            'metadata' => 'required|boolean',
37
        ]);
38
39 1
        return $this->signereRequest->getDetails($request->request_id, $request->metadata)
0 ignored issues
show
Bug introduced by
The property request_id does not seem to exist. Did you mean request?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
40 1
                ->getBody()
41 1
                ->getContents();
42
    }
43
}
44