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

MediaType::validateProperties()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 1
Metric Value
cc 3
eloc 2
c 1
b 1
f 1
nc 2
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
4
namespace Apie\OpenapiSchema\Spec;
5
6
use Apie\OpenapiSchema\Concerns\CompositeValueObjectWithExtension;
7
use Apie\OpenapiSchema\Contract\SchemaContract;
8
use Apie\OpenapiSchema\Exceptions\ExampleAndExamplesAreMutuallyExclusive;
9
use Apie\OpenapiSchema\Map\EncodingMap;
10
use Apie\OpenapiSchema\Map\ExampleMap;
11
use Apie\ValueObjects\ValueObjectInterface;
12
13
/**
14
 * @see https://swagger.io/specification/#media-type-object
15
 */
16
class MediaType implements ValueObjectInterface
17
{
18
    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\MediaType.
Loading history...
19
20
    /**
21
     * @var SchemaContract|Schema|Reference|null
22
     */
23
    private $schema;
0 ignored issues
show
introduced by
The private property $schema is not used, and could be removed.
Loading history...
24
25
    /**
26
     * @var mixed|null
27
     */
28
    private $example;
29
30
    /**
31
     * @var ExampleMap|null
32
     */
33
    private $examples;
34
35
    /**
36
     * @var EncodingMap|null
37
     */
38
    private $encoding;
0 ignored issues
show
introduced by
The private property $encoding is not used, and could be removed.
Loading history...
39
40
    private function validateProperties()
41
    {
42
        if (isset($this->example) && isset($this->examples)) {
43
            throw new ExampleAndExamplesAreMutuallyExclusive();
44
        }
45
    }
46
}
47