Completed
Push — master ( b661a7...3f4b39 )
by Kirill
12:06
created

Event::time()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
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 $startedAt;
19
20
    /**
21
     * @var float
22
     */
23
    public $completedAt;
24
25
    /**
26
     * Create a new instance.
27
     *
28
     * @param RequestInterface  $request
29
     * @param float             $startedAt
30
     * @param float             $completedAt
31
     */
32
    public function __construct(RequestInterface $request, float $startedAt, float $completedAt)
33
    {
34
        $this->request = $request;
35
        $this->startedAt = $startedAt;
36
        $this->completedAt = $completedAt;
37
    }
38
39
    public function time(): float
40
    {
41
        return $this->completedAt - $this->startedAt;
42
    }
43
}
44