EncryptedAssertion::wasSignedAtConstruction()   A
last analyzed

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\SAML2\XML\saml;
6
7
use SimpleSAML\SAML2\XML\EncryptedElementTrait;
8
use SimpleSAML\XML\DOMDocumentFactory;
9
use SimpleSAML\XML\SchemaValidatableElementInterface;
10
use SimpleSAML\XML\SchemaValidatableElementTrait;
11
use SimpleSAML\XMLSecurity\Alg\Encryption\EncryptionAlgorithmInterface;
12
use SimpleSAML\XMLSecurity\XML\EncryptedElementInterface;
13
14
/**
15
 * Class handling encrypted assertions.
16
 *
17
 * @package simplesamlphp/saml2
18
 */
19
final class EncryptedAssertion extends AbstractSamlElement implements
20
    EncryptedElementInterface,
21
    SchemaValidatableElementInterface
22
{
23
    use EncryptedElementTrait;
0 ignored issues
show
introduced by
The trait SimpleSAML\SAML2\XML\EncryptedElementTrait requires some properties which are not provided by SimpleSAML\SAML2\XML\saml\EncryptedAssertion: $localName, $namespaceURI
Loading history...
24
    use SchemaValidatableElementTrait;
25
26
    /** @var bool */
27
    protected bool $wasSignedAtConstruction = false;
28
29
30
    /**
31
     * @inheritDoc
32
     *
33
     * @return \SimpleSAML\SAML2\XML\saml\Assertion
34
     * @throws \Exception
35
     */
36
    public function decrypt(EncryptionAlgorithmInterface $decryptor): Assertion
37
    {
38
        return Assertion::fromXML(
39
            DOMDocumentFactory::fromString($this->decryptData($decryptor))->documentElement,
40
        );
41
    }
42
43
44
    /**
45
     * @return bool
46
     */
47
    public function wasSignedAtConstruction(): bool
48
    {
49
        return $this->wasSignedAtConstruction;
50
    }
51
}
52