ServerVariableObjectList   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
eloc 5
c 2
b 1
f 1
dl 0
loc 10
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getWantedType() 0 6 2
1
<?php
2
3
4
namespace Apie\OpenapiSchema\Map;
5
6
use Apie\CompositeValueObjects\Exceptions\InvalidKeyException;
7
use Apie\CompositeValueObjects\ValueObjectHashmapTrait;
8
use Apie\CompositeValueObjects\ValueObjectListInterface;
9
use Apie\OpenapiSchema\Constants;
10
use Apie\OpenapiSchema\Spec\ServerVariable;
11
use Apie\TypeJuggling\AnotherValueObject;
12
use Apie\TypeJuggling\TypeUtilInterface;
13
14
final class ServerVariableObjectList implements ValueObjectListInterface
15
{
16
    use ValueObjectHashmapTrait;
17
18
    protected static function getWantedType(string $fieldName): TypeUtilInterface
19
    {
20
        if (!preg_match(Constants::VALID_KEY_REGEX, $fieldName)) {
21
            throw new InvalidKeyException($fieldName, null);
22
        }
23
        return new AnotherValueObject($fieldName, ServerVariable::class);
24
    }
25
}
26