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

ValidationException::renderPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
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