Passed
Push — master ( a470ba...be54de )
by Tim
02:20
created

EncryptedAttribute   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 26
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getBlacklistedAlgorithms() 0 2 1
A decrypt() 0 2 1
A getEncryptionBackend() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML2\XML\saml;
6
7
use SimpleSAML\XMLSecurity\Utils\Security;
8
use SimpleSAML\XMLSecurity\XML\EncryptedElementInterface;
9
use SimpleSAML\XMLSecurity\XML\EncryptedElementTrait;
10
use SimpleSAML\XMLSecurity\Alg\Encryption\EncryptionAlgorithmInterface;
11
12
/**
13
 * Class handling encrypted attributes.
14
 *
15
 * @package simplesamlphp/saml2
16
 */
17
class EncryptedAttribute extends AbstractSamlElement implements EncryptedElementInterface
18
{
19
    use EncryptedElementTrait;
1 ignored issue
show
introduced by
The trait SimpleSAML\XMLSecurity\XML\EncryptedElementTrait requires some properties which are not provided by SimpleSAML\SAML2\XML\saml\EncryptedAttribute: $localName, $namespaceURI
Loading history...
20
21
22
    public function getBlacklistedAlgorithms(): ?array
23
    {
24
        // return an array with the algorithms you don't want to allow to be used
25
    }
26
27
28
    public function getEncryptionBackend(): ?EncryptionBackend
0 ignored issues
show
Bug introduced by
The type SimpleSAML\SAML2\XML\saml\EncryptionBackend was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
29
    {
30
        // return the encryption backend you want to use,
31
        // or null if you are fine with the default
32
    }
33
34
35
    /**
36
     * @inheritDoc
37
     *
38
     * @return \SimpleSAML\SAML2\XML\saml\Attribute
39
     * @throws \Exception
40
     */
41
    public function decrypt(EncryptionAlgorithmInterface $decryptor): Attribute
42
    {
43
//        $attrXML = Security::decryptElement($this->encryptedData->toXML(), $key, $blacklist);
44
45
//        return Attribute::fromXML($attrXML);
46
    }
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return SimpleSAML\SAML2\XML\saml\Attribute. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
47
}
48