ChainBuilderValidationException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 19
rs 10
c 1
b 0
f 0
ccs 0
cts 9
cp 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Oliverde8\Component\PhpEtl\Exception;
6
7
use Symfony\Component\Validator\ConstraintViolation;
8
use Throwable;
9
10
/**
11
 * Class ChainBuilderValidationException
12
 *
13
 * @author    de Cramer Oliver<[email protected]>
14
 * @copyright 2018 Oliverde8
15
 * @package Oliverde8\Component\PhpEtl\Exception
16
 */
17
class ChainBuilderValidationException extends \Exception
18
{
19
    /**
20
     * ChainBuilderValidationException constructor.
21
     *
22
     * @param string $operation
23
     * @param ConstraintViolation[] $violations
24
     * @param int $code
25
     * @param Throwable|null $previous
26
     */
27
    public function __construct(string $operation, array $violations, int $code = 0, Throwable $previous = null)
28
    {
29
        $msg = "There was an error building the operation '$operation' : ";
30
        foreach ($violations as $violation) {
31
            $msg .= "\n - " . $violation->getPropertyPath() . " - " . implode(', ', $violation->getParameters()) . " : " . $violation->getMessage();
32
        }
33
        $msg .= "\n";
34
35
        parent::__construct($msg, $code, $previous);
36
    }
37
}