Conditions | 5 |
Paths | 4 |
Total Lines | 20 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
17 | 4 | public function check($element, $schema = null, $path = null, $i = null) |
|
18 | { |
||
19 | 4 | if (!isset($schema->format)) { |
|
20 | 1 | return; |
|
21 | } |
||
22 | |||
23 | 3 | if (array_key_exists($schema->format, $this->formatMap)) { |
|
24 | try { |
||
25 | 1 | $this->formatMap[$schema->format]->validate($element); |
|
26 | 1 | } catch (FormatConstraintException $e) { |
|
27 | 1 | foreach ($e->getErrors() as $error) { |
|
28 | 1 | $this->addError($path, $error, 'format'); |
|
29 | 1 | } |
|
30 | } |
||
31 | |||
32 | 1 | return; |
|
33 | } |
||
34 | |||
35 | 2 | parent::check($element, $schema, $path, $i); |
|
36 | 2 | } |
|
37 | |||
49 |