Completed
Push — master ( c80620...0cd8d9 )
by Martijn
03:25
created

Rfc7405   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 1

1 Method

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