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

MediaType   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
eloc 8
c 2
b 1
f 1
dl 0
loc 28
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A validateProperties() 0 4 3
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