Passed
Push — master ( 7dbee5...7059ae )
by Dmitry
06:55
created

CheckUnexpectedException::catchUnexpectedError()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 13
ccs 10
cts 10
cp 1
rs 9.4285
cc 1
eloc 9
nc 1
nop 3
crap 1
1
<?php
2
3
namespace TonicHealthCheck\Check;
4
5
use Exception;
6
7
/**
8
 * Class CheckUnexpectedException.
9
 */
10
class CheckUnexpectedException extends CheckException
11
{
12
    /**
13
     * @param string    $className
14
     * @param string    $methodName
15
     * @param Exception $error
16
     *
17
     * @return self
18
     */
19 1
    public static function catchUnexpectedError($className, $methodName, Exception $error)
20
    {
21 1
        return new self(
22 1
            sprintf(
23 1
                '%s:%s catch unexpected error:\n%s',
24 1
                $className,
25 1
                $methodName,
26 1
                $error->getMessage()
27 1
            ),
28 1
            0,
29
            $error
30 1
        );
31
    }
32
}
33