Cancelled
Pull Request — develop (#687)
by Alejandro
05:53
created

ShortUrlVisited::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 1
cts 1
cp 1
crap 1
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 10
14
    public function __construct(string $visitId, ?string $originalIpAddress = null)
15 10
    {
16
        $this->visitId = $visitId;
17
        $this->originalIpAddress = $originalIpAddress;
18 8
    }
19
20 8
    public function visitId(): string
21
    {
22
        return $this->visitId;
23
    }
24
25
    public function originalIpAddress(): ?string
26
    {
27
        return $this->originalIpAddress;
28
    }
29
30
    public function jsonSerialize(): array
31
    {
32
        return ['visitId' => $this->visitId, 'originalIpAddress' => $this->originalIpAddress];
33
    }
34
}
35