Passed
Push — master ( 414f0a...c0888e )
by Pierre
03:03
created

DictionaryDataCollector::reset()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 2
ccs 0
cts 1
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Knp\DictionaryBundle\DataCollector;
6
7
use Generator;
8
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
9
10
final class DictionaryDataCollector extends DataCollector
11
{
12 1
    use DictionaryDataCollector\SymfonyCompatibilityTrait;
13
14
    /**
15
     * @param array<mixed> $keys
16
     * @param array<mixed> $values
17
     */
18 9
    public function addDictionary(string $name, array $keys, array $values): void
19
    {
20 9
        $this->data[$name] = array_map(
21 9
            function ($key, $value): array {
22 9
                return ['key' => $key, 'value' => $value];
23 9
            },
24
            $keys,
25
            $values
26
        );
27 9
    }
28
29
    /**
30
     * @return Generator<string, array>
31
     */
32 9
    public function getDictionaries(): Generator
33
    {
34 9
        foreach ($this->data as $name => $keyValuePairs) {
35 8
            yield $name => $keyValuePairs;
36
        }
37 9
    }
38
39
    public function reset(): void
40
    {
41
    }
42
43 1
    public function getName()
44
    {
45 1
        return 'dictionary';
46
    }
47
}
48