SchemaNotParseable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 19
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A rethrow() 0 17 2
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\Config\Exception;
5
6
use Innmind\Immutable\Sequence;
7
8
final class SchemaNotParseable extends DomainException
9
{
10 3
    public static function rethrow(self $exception): self
11
    {
12 3
        $original = $exception;
13 3
        $messages = new Sequence;
14
15
        do {
16 3
            $messages = $messages->add($exception->getMessage());
17 3
        } while ($exception = $exception->getPrevious());
18
19 3
        throw new self(
20
            (string) $messages
21 3
                ->filter(static function(string $message): bool {
22 3
                    return $message !== '';
23 3
                })
24 3
                ->join('.'),
25 3
            0,
26 3
            $original
27
        );
28
    }
29
}
30