Completed
Push — master ( 935a4f...80b369 )
by Veaceslav
01:53
created

ExternalDocumentation   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 4
dl 0
loc 35
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A jsonSerialize() 0 4 1
A normalizeOptionalProperties() 0 6 1
A normalizeRequiredProperties() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Aweapi\Openapi\Objects;
6
7
use Aweapi\Openapi\Extensions;
8
use Aweapi\Openapi\ValueObject;
9
10
final class ExternalDocumentation extends ValueObject
11
{
12
    use Properties\Url;
13
    use Properties\OptionalDescription;
14
    use Properties\OptionalExtensions;
15
16 5
    public function __construct(
17
        string $url,
18
        string $description = null,
19
        Extensions $extensions = null
20
    ) {
21 5
        $this->url = $url;
22 5
        $this->description = $description;
23 5
        $this->extensions = $extensions;
24
    }
25
26 5
    public function jsonSerialize(): ?array
27
    {
28 5
        return $this->extendedProperties(parent::jsonSerialize());
29
    }
30
31 5
    protected function normalizeOptionalProperties(): array
32
    {
33
        return [
34 5
            'description' => $this->getNormalizedDescription(),
35
        ];
36
    }
37
38 5
    protected function normalizeRequiredProperties(): array
39
    {
40
        return [
41 5
            'url' => $this->getUrl(),
42
        ];
43
    }
44
}
45