Exception   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 7
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromResult() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ReliqArts\Scavenger\Exception;
6
7
use ReliqArts\Scavenger\Result;
8
use RuntimeException;
9
10
/**
11
 * Base exception for Scavenger.
12
 */
13
abstract class Exception extends RuntimeException
14
{
15
    public static function fromResult(Result $result): self
16
    {
17
        $errors = implode(' ', $result->getErrors());
18
19
        return new static("The following errors occurred: ${errors}");
20
    }
21
}
22