Completed
Pull Request — develop (#687)
by Alejandro
08:45 queued 02:49
created

ShortUrlVisited   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 77.78%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 24
ccs 7
cts 9
cp 0.7778
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A originalIpAddress() 0 3 1
A jsonSerialize() 0 3 1
A __construct() 0 4 1
A visitId() 0 3 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
14 11
    public function __construct(string $visitId, ?string $originalIpAddress = null)
15
    {
16 11
        $this->visitId = $visitId;
17 11
        $this->originalIpAddress = $originalIpAddress;
18
    }
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