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

Validator::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
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
}