FixedAttributeValueProvider::getValues()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the LightSAML-Core package.
5
 *
6
 * (c) Milos Tomic <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace LightSaml\Provider\Attribute;
13
14
use LightSaml\Context\Profile\AssertionContext;
15
use LightSaml\Model\Assertion\Attribute;
16
17
class FixedAttributeValueProvider implements AttributeValueProviderInterface
18
{
19
    /** @var Attribute[] */
20
    protected $attributes = [];
21
22
    /**
23
     * @return FixedAttributeValueProvider
24
     */
25
    public function add(Attribute $attribute)
26
    {
27
        $this->attributes[] = $attribute;
28
29
        return $this;
30
    }
31
32
    /**
33
     * @param \LightSaml\Model\Assertion\Attribute[] $attributes
34
     *
35
     * @return FixedAttributeValueProvider
36
     */
37
    public function setAttributes(array $attributes)
38
    {
39
        $this->attributes = [];
40
        foreach ($attributes as $attribute) {
41
            $this->add($attribute);
42
        }
43
44
        return $this;
45
    }
46
47
    /**
48
     * @return Attribute[]
49
     */
50
    public function getValues(AssertionContext $context)
51
    {
52
        return $this->attributes;
53
    }
54
}
55