Completed
Push — develop ( 8109ce...b15e90 )
by Alejandro
17s queued 12s
created

ShortUrlVisited::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Shlinkio\Shlink\Core\EventDispatcher;
6
7
use JsonSerializable;
8
9
final class ShortUrlVisited implements JsonSerializable
10
{
11
    private string $visitId;
12
    private ?string $originalIpAddress;
13
14 11
    public function __construct(string $visitId, ?string $originalIpAddress = null)
15
    {
16 11
        $this->visitId = $visitId;
17 11
        $this->originalIpAddress = $originalIpAddress;
18 11
    }
19
20 9
    public function visitId(): string
21
    {
22 9
        return $this->visitId;
23
    }
24
25 7
    public function originalIpAddress(): ?string
26
    {
27 7
        return $this->originalIpAddress;
28
    }
29
30
    public function jsonSerialize(): array
31
    {
32
        return ['visitId' => $this->visitId, 'originalIpAddress' => $this->originalIpAddress];
33
    }
34
}
35