DraftFour   A
last analyzed

Coupling/Cohesion

Components 0
Dependencies 1

Complexity

Total Complexity 1

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 37
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
1
<?php
2
3
namespace League\JsonGuard\RuleSet;
4
5
use League\JsonGuard\Constraint\DraftFour\AdditionalItems;
6
use League\JsonGuard\Constraint\DraftFour\AdditionalProperties;
7
use League\JsonGuard\Constraint\DraftFour\AllOf;
8
use League\JsonGuard\Constraint\DraftFour\AnyOf;
9
use League\JsonGuard\Constraint\DraftFour\Dependencies;
10
use League\JsonGuard\Constraint\DraftFour\Enum;
11
use League\JsonGuard\Constraint\DraftFour\ExclusiveMaximum;
12
use League\JsonGuard\Constraint\DraftFour\ExclusiveMinimum;
13
use League\JsonGuard\Constraint\DraftFour\Format;
14
use League\JsonGuard\Constraint\DraftFour\Items;
15
use League\JsonGuard\Constraint\DraftFour\Maximum;
16
use League\JsonGuard\Constraint\DraftFour\MaxItems;
17
use League\JsonGuard\Constraint\DraftFour\MaxLength;
18
use League\JsonGuard\Constraint\DraftFour\MaxProperties;
19
use League\JsonGuard\Constraint\DraftFour\Minimum;
20
use League\JsonGuard\Constraint\DraftFour\MinItems;
21
use League\JsonGuard\Constraint\DraftFour\MinLength;
22
use League\JsonGuard\Constraint\DraftFour\MinProperties;
23
use League\JsonGuard\Constraint\DraftFour\MultipleOf;
24
use League\JsonGuard\Constraint\DraftFour\Not;
25
use League\JsonGuard\Constraint\DraftFour\OneOf;
26
use League\JsonGuard\Constraint\DraftFour\Pattern;
27
use League\JsonGuard\Constraint\DraftFour\PatternProperties;
28
use League\JsonGuard\Constraint\DraftFour\Properties;
29
use League\JsonGuard\Constraint\DraftFour\Required;
30
use League\JsonGuard\Constraint\DraftFour\Type;
31
use League\JsonGuard\Constraint\DraftFour\UniqueItems;
32
33
/**
34
 * The default rule set for JSON Schema Draft 4.
35
 * @see http://tools.ietf.org/html/draft-zyp-json-schema-04
36
 * @see  https://tools.ietf.org/html/draft-fge-json-schema-validation-00
37
 */
38
final class DraftFour extends RuleSetContainer
39
{
40
    const DEFAULT_RULES = [
41
        AdditionalItems::KEYWORD      => AdditionalItems::class,
42
        AdditionalProperties::KEYWORD => AdditionalProperties::class,
43
        AllOf::KEYWORD                => AllOf::class,
44
        Anyof::KEYWORD                => AnyOf::class,
45
        Dependencies::KEYWORD         => Dependencies::class,
46
        Enum::KEYWORD                 => Enum::class,
47
        ExclusiveMaximum::KEYWORD     => ExclusiveMaximum::class,
48
        ExclusiveMinimum::KEYWORD     => ExclusiveMinimum::class,
49
        Format::KEYWORD               => Format::class,
50
        Items::KEYWORD                => Items::class,
51
        Maximum::KEYWORD              => Maximum::class,
52
        MaxItems::KEYWORD             => MaxItems::class,
53
        MaxLength::KEYWORD            => MaxLength::class,
54
        MaxProperties::KEYWORD        => MaxProperties::class,
55
        Minimum::KEYWORD              => Minimum::class,
56
        MinItems::KEYWORD             => MinItems::class,
57
        MinLength::KEYWORD            => MinLength::class,
58
        MinProperties::KEYWORD        => MinProperties::class,
59
        MultipleOf::KEYWORD           => MultipleOf::class,
60
        Not::KEYWORD                  => Not::class,
61
        OneOF::KEYWORD                => OneOf::class,
62
        Pattern::KEYWORD              => Pattern::class,
63
        PatternProperties::KEYWORD    => PatternProperties::class,
64
        Properties::KEYWORD           => Properties::class,
65
        Required::KEYWORD             => Required::class,
66
        Type::KEYWORD                 => Type::class,
67
        UniqueItems::KEYWORD          => UniqueItems::class,
68
    ];
69
70 242
    public function __construct(array $rules = [])
71
    {
72 242
        parent::__construct(array_merge(self::DEFAULT_RULES, $rules));
73 242
    }
74
}
75