Event   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 41
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A time() 0 4 1
1
<?php declare(strict_types=1);
2
3
namespace Personnage\Tinkoff\SDK\Event;
4
5
use League\Event\AbstractEvent;
6
use Psr\Http\Message\RequestInterface;
7
8
abstract class Event extends AbstractEvent
9
{
10
    /**
11
     * @var RequestInterface
12
     */
13
    public $request;
14
15
    /**
16
     * @var float
17
     */
18
    public $startTime;
19
20
    /**
21
     * @var float
22
     */
23
    public $endTime;
24
25
    /**
26
     * Create a new instance.
27
     *
28
     * @param RequestInterface  $request   The request instance.
29
     * @param float             $startTime The timestamp of the start of the request, with microsecond precision.
30
     * @param float             $endTime   The timestamp of the end of the request, with microsecond precision.
31
     */
32
    public function __construct(RequestInterface $request, float $startTime, float $endTime)
33
    {
34
        $this->request = $request;
35
        $this->startTime = $startTime;
36
        $this->endTime = $endTime;
37
    }
38
39
    /**
40
     * Get total time.
41
     *
42
     * @return float
43
     */
44
    public function time(): float
45
    {
46
        return $this->endTime - $this->startTime;
47
    }
48
}
49