Completed
Push — master ( cec1cf...f9a404 )
by Javi
03:27
created

Discriminator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
1
<?php
2
3
namespace erasys\OpenApi\Spec\v3;
4
5
/**
6
 * When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be
7
 * used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema
8
 * which is used to inform the consumer of the specification of an alternative schema based on the value associated
9
 * with it.
10
 *
11
 * When using the discriminator, inline schemas will not be considered.
12
 *
13
 * @see https://swagger.io/specification/#discriminatorObject
14
 */
15
class Discriminator extends AbstractObject
16
{
17
    /**
18
     * REQUIRED. The name of the property in the payload that will hold the discriminator value.
19
     *
20
     * @var string
21
     */
22
    public $propertyName;
23
24
    /**
25
     * An object to hold mappings between payload values and schema names or references.
26
     *
27
     * @var string[] array<string, string>
28
     */
29
    public $mapping;
30
31
    /**
32
     * @param string   $propertyName
33
     * @param string[] $mapping
34
     */
35 6
    public function __construct(string $propertyName, array $mapping = null)
36
    {
37 6
        parent::__construct([]);
38 6
        $this->propertyName = $propertyName;
39 6
        $this->mapping      = $mapping;
40 6
    }
41
}
42