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

CheckUnexpectedException   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 23
ccs 10
cts 10
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A catchUnexpectedError() 0 13 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