Completed
Push — master ( d96a7a...d56a4b )
by Mahmoud
04:03
created

Controller::trackClose()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 10
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 10
loc 10
rs 9.4285
cc 1
eloc 5
nc 1
nop 2
1
<?php
2
3
namespace App\Containers\Tracker\UI\API\Controllers;
4
5
use App\Containers\Tracker\Actions\TrackCloseAction;
6
use App\Containers\Tracker\Actions\TrackOpenAction;
7
use App\Port\Controller\Abstracts\PortApiController;
8
use Dingo\Api\Http\Request;
9
use Dingo\Api\Http\Response;
10
11
/**
12
 * Class Controller.
13
 *
14
 * @author Mahmoud Zalt <[email protected]>
15
 */
16
class Controller extends PortApiController
17
{
18
19
    /**
20
     * @param \Dingo\Api\Http\Request                         $request
21
     * @param \App\Containers\Tracker\Actions\TrackOpenAction $action
22
     *
23
     * @return  \Dingo\Api\Http\Response
24
     */
25 View Code Duplication
    public function trackOpen(Request $request, TrackOpenAction $action)
0 ignored issues
show
Duplication introduced by
This method 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...
26
    {
27
        $visitorId = $request->header('visitor-id');
28
29
        $action->run($visitorId);
30
31
        return $this->response->accepted(null, [
32
            'message' => 'Session (open) Tracked Successfully.',
33
        ]);
34
    }
35
36
37
    /**
38
     * @param \Dingo\Api\Http\Request                         $request
39
     * @param \App\Containers\Tracker\Actions\TrackOpenAction $action
40
     *
41
     * @return  \Dingo\Api\Http\Response
42
     */
43 View Code Duplication
    public function trackClose(Request $request, TrackCloseAction $action)
0 ignored issues
show
Duplication introduced by
This method 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...
44
    {
45
        $visitorId = $request->header('visitor-id');
46
47
        $action->run($visitorId);
48
49
        return $this->response->accepted(null, [
50
            'message' => 'Session (close) Tracked Successfully.',
51
        ]);
52
    }
53
54
}
55