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

StringCollection::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
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
}