Passed
Pull Request — master (#60)
by Tim
02:59
created

ProtocolViolationException::__construct()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 6
nc 3
nop 1
dl 0
loc 11
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSecurity\Exception;
6
7
/**
8
 * This exception may be raised when a violation of the xmldsig specification is detected
9
 *
10
 * @package simplesamlphp/xml-security
11
 */
12
class ProtocolViolationException extends RuntimeException
13
{
14
    /**
15
     * @param string|null $message
16
     */
17
    public function __construct(?string $message = null)
18
    {
19
        if ($message === null) {
20
            if (defined('static::DEFAULT_MESSAGE')) {
21
                $message = static::DEFAULT_MESSAGE;
0 ignored issues
show
Bug introduced by
The constant SimpleSAML\XMLSecurity\E...eption::DEFAULT_MESSAGE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
22
            } else {
23
                $message = 'A violation of the XML Signature Syntax and Processing specification occurred.';
24
            }
25
        }
26
27
        parent::__construct($message);
28
    }
29
}
30