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

ShortUrlVisited   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 80%

Importance

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

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 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