PathAttributeResolverOptions   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 87
Duplicated Lines 0 %

Coupling/Cohesion

Components 3
Dependencies 0

Test Coverage

Coverage 89.66%

Importance

Changes 0
Metric Value
wmc 12
lcom 3
cbo 0
dl 0
loc 87
ccs 26
cts 29
cp 0.8966
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A setParameterName() 0 5 1
A setPathPartName() 0 5 1
A setPathAttributeResolverType() 0 5 1
A getParameterName() 0 7 2
A getPathPartName() 0 7 2
A getPathAttributeResolverType() 0 7 2
A isResolutionMandatory() 0 4 1
A setResolutionMandatory() 0 5 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Paysera\Bundle\ApiBundle\Entity;
5
6
use RuntimeException;
7
8
class PathAttributeResolverOptions
9
{
10
    /**
11
     * @var string|null
12
     */
13
    private $parameterName;
14
15
    /**
16
     * @var string|null
17
     */
18
    private $pathPartName;
19
20
    /**
21
     * @var string|null
22
     */
23
    private $pathAttributeResolverType;
24
25
    /**
26
     * @var bool
27
     */
28
    private $resolutionMandatory;
29
30 96
    public function __construct()
31
    {
32 96
        $this->resolutionMandatory = true;
33 96
    }
34
35 96
    public function setParameterName(string $parameterName): self
36
    {
37 96
        $this->parameterName = $parameterName;
38 96
        return $this;
39
    }
40
41 96
    public function setPathPartName(string $pathPartName): self
42
    {
43 96
        $this->pathPartName = $pathPartName;
44 96
        return $this;
45
    }
46
47 96
    public function setPathAttributeResolverType(string $pathAttributeResolverType): self
48
    {
49 96
        $this->pathAttributeResolverType = $pathAttributeResolverType;
50 96
        return $this;
51
    }
52
53 7
    public function getParameterName(): string
54
    {
55 7
        if ($this->parameterName === null) {
56
            throw new RuntimeException('parameterName was not set');
57
        }
58 7
        return $this->parameterName;
59
    }
60
61 10
    public function getPathPartName(): string
62
    {
63 10
        if ($this->pathPartName === null) {
64
            throw new RuntimeException('pathPartName was not set');
65
        }
66 10
        return $this->pathPartName;
67
    }
68
69 99
    public function getPathAttributeResolverType(): string
70
    {
71 99
        if ($this->pathAttributeResolverType === null) {
72
            throw new RuntimeException('pathAttributeResolverType was not set');
73
        }
74 99
        return $this->pathAttributeResolverType;
75
    }
76
77
    /**
78
     * @return bool
79
     */
80 5
    public function isResolutionMandatory(): bool
81
    {
82 5
        return $this->resolutionMandatory;
83
    }
84
85
    /**
86
     * @param bool $resolutionMandatory
87
     * @return $this
88
     */
89 96
    public function setResolutionMandatory(bool $resolutionMandatory): self
90
    {
91 96
        $this->resolutionMandatory = $resolutionMandatory;
92 96
        return $this;
93
    }
94
}
95