ListPattern::from()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace ICanBoogie\CLDR\General\Lists;
4
5
/**
6
 * @link https://www.unicode.org/reports/tr35/tr35-72/tr35-general.html#ListPatterns
7
 */
8
final class ListPattern
9
{
10
    /**
11
     * @param array{
12
     *     2: string,
13
     *     start: string,
14
     *     middle: string,
15
     *     end: string,
16
     * } $list_pattern
17
     */
18
    public static function from(array $list_pattern): self
19
    {
20
        return new self(
21
            $list_pattern[2],
22
            $list_pattern['start'],
23
            $list_pattern['middle'],
24
            $list_pattern['end']
25
        );
26
    }
27
28
    private function __construct(
29
        public readonly string $two,
30
        public readonly string $start,
31
        public readonly string $middle,
32
        public readonly string $end
33
    ) {
34
    }
35
}
36