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

ListFormatterLocalized::format()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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