getEncryptedAssertionReader()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 9
c 0
b 0
f 0
ccs 0
cts 5
cp 0
rs 9.9666
cc 2
nc 2
nop 1
crap 6
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\Context\Profile\Helper;
13
14
use LightSaml\Context\Profile\AssertionContext;
15
use LightSaml\Error\LightSamlContextException;
16
use LightSaml\Model\Assertion\EncryptedAssertionReader;
17
18
abstract class AssertionContextHelper
19
{
20
    /**
21
     * @param AssertionContext $context
22
     *
23
     * @return EncryptedAssertionReader
24
     */
25
    public static function getEncryptedAssertionReader(AssertionContext $context)
26
    {
27
        $result = $context->getEncryptedAssertion();
28
        if ($result instanceof EncryptedAssertionReader) {
29
            return $result;
30
        }
31
32
        throw new LightSamlContextException($context, 'Expected EncryptedAssertionReader');
33
    }
34
}
35