OpenSSLException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 8
c 1
b 0
f 0
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSecurity\Exception;
6
7
/**
8
 * Class OpenSSLException
9
 *
10
 * This exception is thrown when an error occurs during a call to the openssl backend.
11
 *
12
 * @package simplesamlphp/xml-security
13
 */
14
class OpenSSLException extends RuntimeException
15
{
16
    /**
17
     */
18
    public function __construct(string $message = 'Generic OpenSSL exception')
19
    {
20
        $stack = [];
21
        while (($msg = openssl_error_string()) !== false) {
22
            $stack[] = $msg;
23
        }
24
25
        foreach ($stack as $line) {
26
            $message .= '; ' . $line;
27
        }
28
        $message .= '.';
29
30
        parent::__construct($message);
31
    }
32
}
33