Passed
Pull Request — master (#374)
by Tim
02:48
created

SAMLDateTimeTrait::validSAMLDateTime()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 8
nc 2
nop 2
dl 0
loc 12
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML2\Assert;
6
7
use SimpleSAML\Assert\AssertionFailedException;
8
use SimpleSAML\SAML2\Exception\ProtocolViolationException;
9
10
/**
11
 * @package simplesamlphp/saml2
12
 */
13
trait SAMLDateTimeTrait
14
{
15
    /**
16
     * @param string $value
17
     * @param string $message
18
     */
19
    protected static function validSAMLDateTime(string $value, string $message = ''): void
0 ignored issues
show
Unused Code introduced by
The parameter $message is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

19
    protected static function validSAMLDateTime(string $value, /** @scrutinizer ignore-unused */ string $message = ''): void

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
20
    {
21
        parent::validDateTime($value);
22
23
        try {
24
            parent::endsWith(
25
                $value,
26
                'Z',
27
                '%s is not a DateTime expressed in the UTC timezone using the \'Z\' timezone identifier.',
28
            );
29
        } catch (AssertionFailedException $e) {
30
            throw new ProtocolViolationException($e->getMessage());
31
        }
32
    }
33
}
34