Passed
Push — master ( 1515ff...7c0b30 )
by Sebastian
04:21
created

Mailcode_Traits_Commands_Validation_CaseSensitive   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 17
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A validateSyntax_case_sensitive() 0 5 1
A isCaseInsensitive() 0 3 1
1
<?php
2
/**
3
 * File containing the {@see Mailcode_Traits_Commands_Validation_Variable} trait.
4
 *
5
 * @package Mailcode
6
 * @subpackage Validation
7
 * @see Mailcode_Traits_Commands_Validation_Variable
8
 */
9
10
declare(strict_types=1);
11
12
namespace Mailcode;
13
14
/**
15
 * Command validation drop-in: checks for the presence
16
 * of the `insensitive:` keyword in the command statement,
17
 * and sets the case insensitive flag accordingly.
18
 *
19
 * @package Mailcode
20
 * @subpackage Validation
21
 * @author Sebastian Mordziol <[email protected]>
22
 *
23
 * @property Mailcode_Parser_Statement_Validator $validator
24
 */
25
trait Mailcode_Traits_Commands_Validation_CaseSensitive
26
{
27
   /**
28
    * @var boolean
29
    */
30
    protected $caseInsensitive = false;
31
32
    protected function validateSyntax_case_sensitive() : void
33
    {
34
        $val = $this->validator->createKeyword('insensitive');
35
        
36
        $this->caseInsensitive = $val->isValid();
37
    }
38
    
39
    public function isCaseInsensitive() : bool
40
    {
41
        return $this->caseInsensitive;
42
    }
43
}
44