Reference   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 31
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A createFromArray() 0 10 1
1
<?php
2
3
namespace PtrTn\Battlerite\Dto\Match;
4
5
use PtrTn\Battlerite\Assert\Assert;
6
7
class Reference
8
{
9
    /**
10
     * @var string
11
     */
12
    public $id;
13
14
    /**
15
     * @var string
16
     */
17
    public $type;
18
19 17
    private function __construct(
20
        string $type,
21
        string $id
22
    ) {
23 17
        $this->type = $type;
24 17
        $this->id = $id;
25 17
    }
26
27 17
    public static function createFromArray(array $reference): self
28
    {
29 17
        Assert::string($reference['type']);
30 17
        Assert::string($reference['id']);
31
32 17
        return new self(
33 17
            $reference['type'],
34 17
            $reference['id']
35
        );
36
    }
37
}
38