Passed
Push — master ( c1f9a4...4b0053 )
by Rimas
02:42 queued 32s
created

QueryValidator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 24
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getViolations() 0 3 1
A __construct() 0 5 1
1
<?php
2
namespace Dokobit\Gateway\Exception;
3
4
use Symfony\Component\Validator\ConstraintViolationList;
5
6
/**
7
 * Validator found violations while validating query field values
8
 */
9
class QueryValidator extends \InvalidArgumentException
10
{
11
    /** @var ConstraintViolationList */
12
    private $violations;
13
14
    /**
15
     * @param string $message
16
     * @param ConstraintViolationList $violations
17
     * @return self
18
     */
19
    public function __construct($message, ConstraintViolationList $violations)
20
    {
21
        parent::__construct($message . ': ' . (string)$violations);
22
23
        $this->violations = $violations;
24
    }
25
26
    /**
27
     * Get validation violations
28
     * @return ConstraintViolationList
29
     */
30
    public function getViolations(): ConstraintViolationList
31
    {
32
        return $this->violations;
33
    }
34
}
35