Not   A
last analyzed

Coupling/Cohesion

Components 0
Dependencies 2

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 10 2
1
<?php
2
3
namespace League\JsonGuard\Constraint\DraftFour;
4
5
use League\JsonGuard\Assert;
6
use League\JsonGuard\ConstraintInterface;
7
use League\JsonGuard\Validator;
8
use function League\JsonGuard\error;
9
10
final class Not implements ConstraintInterface
11
{
12
    const KEYWORD = 'not';
13
14
    /**
15
     * {@inheritdoc}
16
     */
17 4
    public function validate($value, $parameter, Validator $validator)
18
    {
19 4
        Assert::type($parameter, 'object', self::KEYWORD, $validator->getSchemaPath());
20
21 2
        $subValidator = $validator->makeSubSchemaValidator($value, $parameter);
22 2
        if ($subValidator->passes()) {
23 2
            return error('The data must not match the schema.', $validator);
24
        }
25 2
        return null;
26
    }
27
}
28