Rfc7405   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 8
dl 0
loc 17
ccs 6
cts 6
cp 1
rs 10
c 1
b 1
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 1
1
<?php
2
3
/** @noinspection PhpUndefinedFieldInspection */
4
5
/**
6
 * RFC 7405 - Case-Sensitive String Support in ABNF.
7
 *
8
 * Updates RFC 5234
9
 *
10
 * @see     https://tools.ietf.org/html/rfc7405
11
 */
12
13
namespace Vanderlee\Comprehend\Library;
14
15
require_once 'functions.php';
16
17
use Vanderlee\Comprehend\Parser\Parser;
18
19
/**
20
 * @property-read Parser case_sensitive_string
21
 * @property-read Parser quoted_string
22
 * @property-read Parser case_insensitive_string
23
 */
24
class Rfc7405 extends Rfc5234
25
{
26
    protected static $name = 'Rfc7405';
27
28 1
    public function __construct($overwrites = [])
29
    {
30
        $rules = [
31
            /*
32
             * 2.2 ABNF Definition of ABNF - char-val
33
             */
34 1
            'quoted_string' => s($this->DQUOTE, star(c(range(0x20, 0x21), range(0x23, 0x7E))), $this->DQUOTE),
35 1
            'case_sensitive_string' => s('%s', $this->quoted_string),
36 1
            'case_insensitive_string' => s(opt('%i'), $this->quoted_string),
37 1
            'char_val' => c($this->case_insensitive_string, $this->case_sensitive_string),
38
        ];
39
40 1
        parent::__construct(array_merge($rules, $overwrites));
41 1
    }
42
}
43