Passed
Pull Request — master (#225)
by Jaime Pérez
02:23
created

EncryptedAttribute   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 19
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A decrypt() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SAML2\XML\saml;
6
7
use RobRichards\XMLSecLibs\XMLSecurityKey;
8
use SAML2\Utils;
9
use SAML2\XML\AbstractXMLElement;
10
use SAML2\XML\EncryptedElementInterface;
11
use SAML2\XML\EncryptedElementTrait;
12
13
/**
14
 * Class handling encrypted attributes.
15
 *
16
 * @package simplesamlphp/saml2
17
 */
18
class EncryptedAttribute extends AbstractSamlElement implements EncryptedElementInterface
19
{
20
    use EncryptedElementTrait;
1 ignored issue
show
introduced by
The trait SAML2\XML\EncryptedElementTrait requires some properties which are not provided by SAML2\XML\saml\EncryptedAttribute: $localName, $namespaceURI
Loading history...
21
22
23
    /**
24
     * @inheritDoc
25
     *
26
     * @return \SAML2\XML\saml\Attribute
27
     * @throws \Exception
28
     *
29
     * @psalm-suppress MismatchingDocblockReturnType
30
     * @psalm-suppress ImplementedReturnTypeMismatch
31
     */
32
    public function decrypt(XMLSecurityKey $key, array $blacklist = []): AbstractXMLElement
33
    {
34
        $attrXML = Utils::decryptElement($this->encryptedData->toXML(), $key, $blacklist);
35
36
        return Attribute::fromXML($attrXML);
37
    }
38
}
39