Passed
Branch master (7f48e0)
by Felipe
06:05
created

ContainerException::createFromThrowable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 6
ccs 0
cts 5
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
/**
4
 * This file is part of coisa/error-handler.
5
 *
6
 * (c) Felipe Sayão Lobato Abreu <[email protected]>
7
 *
8
 * This source file is subject to the license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
declare(strict_types=1);
13
14
namespace CoiSA\ErrorHandler\Container\Exception;
15
16
use Psr\Container\ContainerExceptionInterface;
17
18
/**
19
 * Class ContainerException
20
 *
21
 * @package CoiSA\ErrorHandler\Container\Exception
22
 */
23
class ContainerException extends \Exception implements ContainerExceptionInterface
24
{
25
    /**
26
     * @param \Throwable $throwable
27
     *
28
     * @return ContainerException
29
     */
30
    public static function createFromThrowable(\Throwable $throwable): self
31
    {
32
        return new self(
33
            $throwable->getMessage(),
34
            $throwable->getCode(),
35
            $throwable
36
        );
37
    }
38
}
39