AssertionVersionAction::doExecute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 0
cts 8
cp 0
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
/*
4
 * This file is part of the LightSAML-IDP package.
5
 *
6
 * (c) Milos Tomic <[email protected]>
7
 *
8
 * This source file is subject to the GPL-3 license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace LightSaml\Idp\Action\Assertion\Outbound;
13
14
use LightSaml\Action\Assertion\AbstractAssertionAction;
15
use LightSaml\Context\Profile\AssertionContext;
16
use LightSaml\Context\Profile\Helper\LogHelper;
17
use Psr\Log\LoggerInterface;
18
19
class AssertionVersionAction extends AbstractAssertionAction
20
{
21
    /** @var string */
22
    private $version;
23
24
    /**
25
     * @param LoggerInterface $logger
26
     * @param string          $version
27
     */
28
    public function __construct(LoggerInterface $logger, $version)
29
    {
30
        parent::__construct($logger);
31
32
        $this->version = $version;
33
    }
34
35
    /**
36
     * @param AssertionContext $context
37
     *
38
     * @return void
39
     */
40
    protected function doExecute(AssertionContext $context)
41
    {
42
        $context->getAssertion()->setVersion($this->version);
43
44
        $this->logger->debug(
45
            sprintf('Assertion Version set to "%s"', $this->version),
46
            LogHelper::getActionContext($context, $this)
47
        );
48
    }
49
}
50