ClassMetadata   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 39
c 2
b 0
f 0
rs 10
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getMapping() 0 3 1
A isEmpty() 0 3 2
A __construct() 0 5 1
A getAttributes() 0 3 1
A getParameters() 0 3 1
1
<?php
2
/**
3
 * Schema Validator
4
 *
5
 * @author Vlad Shashkov <[email protected]>
6
 * @copyright Copyright (c) 2021, The Myaza Software
7
 */
8
9
declare(strict_types=1);
10
11
namespace SchemaValidator\Metadata;
12
13
use Symfony\Component\Serializer\Mapping\AttributeMetadataInterface;
14
15
/**
16
 * @codeCoverageIgnore
17
 */
18
final class ClassMetadata
19
{
20
    /**
21
     * ClassMetaData constructor.
22
     *
23
     * @param AttributeMetadataInterface[] $attributes
24
     * @param \ReflectionParameter[]       $parameters
25
     */
26
    public function __construct(
27
        private array $attributes,
28
        private array $parameters,
29
        private ?ClassDiscriminatorMapping $mapping = null,
30
    ) {
31
    }
32
33
    /**
34
     * @return AttributeMetadataInterface[]
35
     */
36
    public function getAttributes(): array
37
    {
38
        return $this->attributes;
39
    }
40
41
    /**
42
     * @return \ReflectionParameter[]
43
     */
44
    public function getParameters(): array
45
    {
46
        return $this->parameters;
47
    }
48
49
    public function getMapping(): ?ClassDiscriminatorMapping
50
    {
51
        return $this->mapping;
52
    }
53
54
    public function isEmpty(): bool
55
    {
56
        return [] === $this->parameters && [] === $this->attributes;
57
    }
58
}
59