fromApplicationHealthError()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 9
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cushon\HealthBundle\Handler\CheckHealth\Exception;
6
7
use Cushon\HealthBundle\ApplicationHealth\Exception\ApplicationHealthError;
8
use RuntimeException;
9
10
final class ApplicationHealthCheckFailure extends RuntimeException implements CheckHealthHandlerError
11
{
12
    /**
13
     * Use the code of one of the Zeroid Space Sergeant.
14
     * @see https://en.wikipedia.org/wiki/Terrahawks#Characters
15
     */
16
    public const ERROR_CODE = 101;
17
18
    /**
19
     * @param ApplicationHealthError $exc
20
     * @return self
21
     */
22
    public static function fromApplicationHealthError(ApplicationHealthError $exc): self
23
    {
24
        return new self(
25
            sprintf(
26
                'Unhandled application health dependency check error: %s',
27
                $exc->getMessage()
28
            ),
29
            self::ERROR_CODE,
30
            $exc
31
        );
32
    }
33
}
34