Test Setup Failed
Push — main ( e03535...dde247 )
by Pieter
03:39
created

CallbackPathItemList::offsetSet()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 6
c 1
b 0
f 0
nc 3
nop 2
dl 0
loc 10
rs 10

1 Method

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