Passed
Push — master ( 8413b2...00f101 )
by Tim
02:19
created

FacetsTrait::getFacets()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSchema\XML\Trait;
6
7
use SimpleSAML\XML\Assert\Assert;
8
use SimpleSAML\XML\Constants as C;
9
use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
10
use SimpleSAML\XMLSchema\XML\Interface\FacetInterface;
11
12
/**
13
 * Trait grouping common functionality for elements that are part of the xs:facets group.
14
 *
15
 * @package simplesamlphp/xml-common
16
 */
17
trait FacetsTrait
18
{
19
    /**
20
     * The facets.
21
     *
22
     * @var \SimpleSAML\XMLSchema\XML\Interface\FacetInterface[]
23
     */
24
    protected array $facets;
25
26
27
    /**
28
     * Collect the value of the facets-property
29
     *
30
     * @return \SimpleSAML\XMLSchema\XML\Interface\FacetInterface[]
31
     */
32
    public function getFacets(): array
33
    {
34
        return $this->facets;
35
    }
36
37
38
    /**
39
     * Set the value of the facets-property
40
     *
41
     * @param \SimpleSAML\XMLSchema\XML\Interface\FacetInterface[] $facets
42
     */
43
    protected function setFacets(array $facets): void
44
    {
45
        Assert::maxCount($facets, C::UNBOUNDED_LIMIT);
46
        Assert::allIsInstanceOf($facets, FacetInterface::class, SchemaViolationException::class);
47
        $this->facets = $facets;
48
    }
49
}
50