AssertionIssueInstantAction   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 5
dl 0
loc 31
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A doExecute() 0 9 1
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 LightSaml\Provider\TimeProvider\TimeProviderInterface;
18
use Psr\Log\LoggerInterface;
19
20
class AssertionIssueInstantAction extends AbstractAssertionAction
21
{
22
    /** @var TimeProviderInterface */
23
    protected $timeProvider;
24
25
    /**
26
     * @param LoggerInterface       $logger
27
     * @param TimeProviderInterface $timeProvider
28
     */
29
    public function __construct(LoggerInterface $logger, TimeProviderInterface $timeProvider)
30
    {
31
        parent::__construct($logger);
32
33
        $this->timeProvider = $timeProvider;
34
    }
35
36
    /**
37
     * @param AssertionContext $context
38
     *
39
     * @return void
40
     */
41
    protected function doExecute(AssertionContext $context)
42
    {
43
        $context->getAssertion()->setIssueInstant($this->timeProvider->getTimestamp());
44
45
        $this->logger->info(
46
            sprintf('Assertion IssueInstant set to "%s"', $context->getAssertion()->getIssueInstantString()),
47
            LogHelper::getActionContext($context, $this)
48
        );
49
    }
50
}
51