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

Example::toNative()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 10
c 1
b 0
f 0
nc 8
nop 0
dl 0
loc 15
rs 9.9332
1
<?php
2
3
4
namespace Apie\OpenapiSchema\Spec;
5
6
use Apie\CommonValueObjects\Url;
7
use Apie\OpenapiSchema\Concerns\CompositeValueObjectWithExtension;
8
use Apie\OpenapiSchema\Exceptions\ExampleValueAndExternalValueAreMutuallyExclusive;
9
use Apie\OpenapiSchema\ValueObjects\SpecificationExtension;
10
use Apie\ValueObjects\ValueObjectInterface;
11
12
class Example implements ValueObjectInterface
13
{
14
    use CompositeValueObjectWithExtension;
0 ignored issues
show
Bug introduced by
The trait Apie\OpenapiSchema\Conce...alueObjectWithExtension requires the property $name which is not provided by Apie\OpenapiSchema\Spec\Example.
Loading history...
15
16
    /**
17
     * @var string|null
18
     */
19
    private $summary;
0 ignored issues
show
introduced by
The private property $summary is not used, and could be removed.
Loading history...
20
21
    /**
22
     * @var string|null
23
     */
24
    private $description;
0 ignored issues
show
introduced by
The private property $description is not used, and could be removed.
Loading history...
25
26
    /**
27
     * @var mixed|null
28
     */
29
    private $value;
30
31
    /**
32
     * @var Url|null
33
     */
34
    private $externalValue;
35
36
    /**
37
     * @var SpecificationExtension
38
     */
39
    private $specificationExtension;
40
41
    public function __construct()
42
    {
43
        $this->specificationExtension = new SpecificationExtension([]);
44
    }
45
46
    private function validateProperties(): void
47
    {
48
        if (isset($this->value) && isset($this->externalValue)) {
49
            throw new ExampleValueAndExternalValueAreMutuallyExclusive();
50
        }
51
    }
52
}
53