OpenSSLException::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 9
ccs 0
cts 6
cp 0
rs 10
c 1
b 0
f 0
cc 2
nc 2
nop 1
crap 6
1
<?php
2
3
namespace LE_ACME2\Exception;
4
5
class OpenSSLException extends AbstractException {
6
7
    public function __construct(string $function) {
8
9
        $errors = [];
10
        while(($error = openssl_error_string()) !== false) {
11
            $errors[] = $error;
12
        }
13
14
        parent::__construct(
15
            $function . ' failed - error messages: ' . var_export($errors, true)
16
        );
17
    }
18
}