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

SAMLDateTimeTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 18
rs 10
c 1
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A validSAMLDateTime() 0 12 2
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