Completed
Push — master ( 297d81...f5b8f3 )
by Alexandr
01:26
created

Validator::validate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 0
crap 2
1
<?php
2
3
namespace Bricks\Data;
4
5
use Bricks\Exception\ValidationException;
6
7
/**
8
 * Class Validator
9
 * @package Bricks\Data
10
 */
11
class Validator extends \Valitron\Validator
12
{
13
    /**
14
     * @return bool
15
     * @throws ValidationException
16
     */
17 4
    public function validate(): bool
18
    {
19 4
        if (parent::validate() === false) {
20 2
            throw new ValidationException($this->_errors);
21
        }
22 2
        return true;
23
    }
24
25
    /**
26
     * @param array $data
27
     * @return static
28
     */
29 3
    public static function create(array $data = [])
30
    {
31 3
        return new static($data);
32
    }
33
}