Completed
Pull Request — master (#328)
by Luc
04:54
created

PlaceThemeResolver::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace CultuurNet\UDB3\Place;
4
5
use CultuurNet\UDB3\Offer\ThemeResolverInterface;
6
use CultuurNet\UDB3\Theme;
7
use ValueObjects\StringLiteral\StringLiteral;
8
9
class PlaceThemeResolver implements ThemeResolverInterface
10
{
11
    /**
12
     * @var Theme[]
13
     */
14
    private $themes;
15
16
    public function __construct()
17
    {
18
        $this->themes = [];
19
    }
20
21
    /**
22
     * @inheritdoc
23
     */
24 View Code Duplication
    public function byId(StringLiteral $themeId)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
25
    {
26
        if (!array_key_exists((string) $themeId, $this->themes)) {
27
            throw new \Exception("Unknown place theme id: " . $themeId);
28
        }
29
        return $this->themes[(string) $themeId];
30
    }
31
}
32