Completed
Pull Request — master (#1)
by steven
04:42
created

Language   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
1
<?php
2
3
namespace VSV\GVQ_API\Question;
4
5
class Language
6
{
7
    /**
8
     * @var string
9
     */
10
    private $value;
11
12
    /**
13
     * @var string[]
14
     */
15
    private $supportedLanguages = ['nl', 'fr'];
16
17
    /**
18
     * @param string $value
19
     */
20
    public function __construct(string $value)
21
    {
22
        if (!in_array($value, $this->supportedLanguages)) {
23
            throw new \InvalidArgumentException(
24
                'Given language ' . $value . ' is not supported, only nl en fr are allowed.'
25
            );
26
        }
27
28
        $this->value = $value;
29
    }
30
}
31