RequestIdController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 35
loc 35
ccs 10
cts 10
cp 1
rs 10
wmc 2
lcom 0
cbo 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 6 6 1
A __invoke() 11 11 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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