GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

PropertyAggregators   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 8
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 56
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A registerAggregatorRelay() 0 4 1
A addCharacters() 0 7 2
A getByProperty() 0 8 2
A getIterator() 0 6 2
1
<?php
2
3
namespace UCD\Infrastructure\Repository\CharacterRepository\FileRepository;
4
5
use UCD\Exception\UnexpectedValueException;
6
use UCD\Unicode\Codepoint\AggregatorRelay;
7
8
class PropertyAggregators implements \IteratorAggregate
9
{
10
    /**
11
     * @var \SplObjectStorage
12
     */
13
    private $map;
14
15
    public function __construct()
16
    {
17
        $this->map = new \SplObjectStorage();
18
    }
19
20
    /**
21
     * @param Property $property
22
     * @param AggregatorRelay $aggregatorRelay
23
     */
24
    public function registerAggregatorRelay(Property $property, AggregatorRelay $aggregatorRelay)
25
    {
26
        $this->map->attach($property, $aggregatorRelay);
27
    }
28
29
    /**
30
     * @param array $characters
31
     */
32
    public function addCharacters(array $characters)
33
    {
34
        foreach ($this->map as $key) {
35
            $aggregator = $this->map->offsetGet($key);
36
            $aggregator->addMany($characters);
37
        }
38
    }
39
40
    /**
41
     * @param Property $property
42
     * @return AggregatorRelay
43
     * @throws UnexpectedValueException
44
     */
45
    public function getByProperty(Property $property)
46
    {
47
        if (!$this->map->offsetExists($property)) {
48
            throw new UnexpectedValueException();
49
        }
50
51
        return $this->map->offsetGet($property);
52
    }
53
54
    /**
55
     * {@inheritDoc}
56
     */
57
    public function getIterator()
58
    {
59
        foreach ($this->map as $key) {
60
            yield $key => $this->map->offsetGet($key);
61
        }
62
    }
63
}