Completed
Push — master ( 9f1a25...922242 )
by De Cramer
10s
created

ChainBuilderValidationException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

1 Method

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