ValidationException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 18
ccs 0
cts 9
cp 0
rs 10
c 1
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __toString() 0 8 2
1
<?php declare(strict_types=1);
2
3
namespace Diezz\YamlToObjectMapper;
4
5
class ValidationException extends \Exception
6
{
7
    private ValidationResult $result;
8
9
    public function __construct(ValidationResult $result)
10
    {
11
        $this->result = $result;
12
        parent::__construct((string)$this);
13
    }
14
15
    public function __toString()
16
    {
17
        $output = "\nThere are validation errors: \n";
18
        foreach ($this->result->getErrors() as $error) {
19
            $output .= " - $error\n";
20
        }
21
22
        return $output;
23
    }
24
}
25