TrackTrafficEvent::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 2
b 0
f 0
nc 1
nop 3
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Sfneal\Tracking\Events;
4
5
use Illuminate\Http\RedirectResponse;
6
use Illuminate\Http\Request;
7
use Illuminate\Http\Response;
8
use Sfneal\Events\Event;
9
use Sfneal\Tracking\Actions\ParseTraffic;
10
11
class TrackTrafficEvent extends Event
12
{
13
    /**
14
     * @var array
15
     */
16
    public $tracking = [];
17
18
    /**
19
     * Create a new event instance.
20
     *
21
     * @param  Request  $request
22
     * @param  Response|RedirectResponse  $response
23
     * @param  string|null  $timestamp
24
     */
25
    public function __construct(Request $request, $response, string $timestamp = null)
26
    {
27
        $this->tracking = (new ParseTraffic($request, $response, $timestamp ?? microtime()))->execute();
28
    }
29
}
30