FormatKeyword   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 22
c 1
b 0
f 0
dl 0
loc 45
ccs 2
cts 2
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace JsonSchema\Keyword;
6
7
class FormatKeyword extends AbstractKeyword
8
{
9
    const NAME = 'format';
10
11
    // Dates and times
12
    const FORMAT_DATE_TIME = 'date-time';
13
    const FORMAT_DATE = 'date';
14
    const FORMAT_TIME = 'time';
15
    const FORMAT_DURATION = 'duration';
16
17
    // Email addresses
18
    const FORMAT_EMAIL = 'email';
19
    const FORMAT_IDN_EMAIL = 'idn-email';
20
21
    // Hostnames
22
    const FORMAT_HOSTNAME = 'hostname';
23
    const FORMAT_IDN_HOSTNAME = 'idn-hostname';
24
25
    // IP Addresses
26
    const FORMAT_IPV4 = 'ipv4';
27
    const FORMAT_IPV6 = 'ipv6';
28
29
    // Resource identifiers
30
    const FORMAT_URI = 'uri';
31
    const FORMAT_URI_REFERENCE = 'uri-reference';
32
    const FORMAT_IRI = 'iri';
33
    const FORMAT_IRI_REFERENCE = 'iri-reference';
34
    const FORMAT_UUID = 'uuid';
35
36
    // URI template
37
    const FORMAT_URI_TEMPLATE = 'uri-template';
38
39
    // JSON Pointer
40
    const FORMAT_JSON_POINTER = 'json-pointer';
41
    const FORMAT_RELATIVE_JSON_POINTER = 'relative-json-pointer';
42
43
    // Regular Expressions
44
    const FORMAT_REGEX = 'regex';
45
46 1
    public function __construct(?string $format)
47
    {
48
        // TODO uncomment https://github.com/phpstan/phpstan-webmozart-assert/issues/33
49
        // Assert::nullOrStringNotEmpty($format);
50
51 1
        parent::__construct(static::NAME, $format);
52 1
    }
53
}
54