Reference::jsonSerialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Aweapi\Openapi\Objects;
6
7
use Aweapi\Openapi\Definition;
8
9
final class Reference implements
10
    Definition,
11
    SchemaAggregate,
12
    ResponseAggregate,
13
    ParameterAggregate,
14
    RequestBodyAggregate,
15
    HeaderAggregate,
16
    SecuritySchemeAggregate,
17
    ExampleAggregate,
18
    LinkAggregate
19
{
20
    private $href;
21
22 26
    public function __construct(string $href)
23
    {
24 26
        $this->href = $href;
25
    }
26
27 25
    public function getHref(): string
28
    {
29 25
        return $this->href;
30
    }
31
32 25
    public function jsonSerialize(): ?array
33
    {
34
        return [
35 25
            '$ref' => $this->getHref(),
36
        ];
37
    }
38
}
39