Passed
Push — master ( 47e3e0...5cec02 )
by Fike
03:28
created

ValidationException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A renderPath() 0 3 1
A __construct() 0 4 1
1
<?php
2
3
namespace AmaTeam\Image\Projection\Framework\Validation;
4
5
use LogicException;
6
7
/**
8
 * Designed to be thrown whenever validation fails
9
 */
10
class ValidationException extends LogicException
11
{
12
    /**
13
     * @inheritDoc
14
     */
15
    public function __construct($violation, array $path = [], $previous = null)
16
    {
17
        $message = sprintf('%s: %s', self::renderPath($path), $violation);
18
        parent::__construct($message, 0, $previous);
19
    }
20
21
    private static function renderPath(array $path)
22
    {
23
        return implode('.', array_merge(['$'], $path));
24
    }
25
}
26