Passed
Branch master (63685a)
by Felipe
03:15
created

ContainerException::createFromThrowable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
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 1
    public static function createFromThrowable(\Throwable $throwable): self
31
    {
32 1
        return new self(
33 1
            $throwable->getMessage(),
34 1
            $throwable->getCode(),
35 1
            $throwable
36
        );
37
    }
38
}
39