Passed
Pull Request — 1.0.0 (#3)
by
unknown
08:59
created

StringCollection   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 23
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A toArray() 0 3 1
A fromArray() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace StraTDeS\VO\Collection;
6
7
use TypeError;
8
9
class StringCollection
10
{
11
    /** @var string[] */
12
    private array $array;
13
14
    private function __construct(string ...$array)
15
    {
16
        $this->array = $array;
17
    }
18
19
    /**
20
     * @param array $array
21
     * @return static
22
     * @throws TypeError
23
     */
24
    public static function fromArray(array $array): self
25
    {
26
        return new static(...$array);
27
    }
28
29
    public function toArray(): array
30
    {
31
        return $this->array;
32
    }
33
}