Passed
Push — 6.0 ( 4ac4e1...87e1d7 )
by Olivier
01:56
created

ListFormatterLocalized   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 3
dl 0
loc 12
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A format() 0 5 1
1
<?php
2
3
namespace ICanBoogie\CLDR\General\Lists;
4
5
use ICanBoogie\CLDR\Core\Formatter;
6
use ICanBoogie\CLDR\Core\LocalizedObject;
7
8
/**
9
 * Formats variable-length lists of things.
10
 *
11
 * @extends LocalizedObject<ListFormatter>
12
 *
13
 * @link https://www.unicode.org/reports/tr35/tr35-72/tr35-general.html#ListPatterns
14
 */
15
class ListFormatterLocalized extends LocalizedObject implements Formatter
16
{
17
    /**
18
     * Formats variable-length lists of scalars.
19
     *
20
     * @param scalar[] $list
21
     */
22
    public function format(array $list, ListType $type = ListType::STANDARD): string
23
    {
24
        $list_pattern = ListPattern::from($this->locale['listPatterns']["listPattern-type-$type->value"]);
25
26
        return $this->target->format($list, $list_pattern);
27
    }
28
}
29