Test Failed
Push — master ( f51294...9c5f94 )
by Sebastian
03:08
created

Mailcode_Commands_IfBase::supportsLogicKeywords()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
/**
3
 * File containing the {@see Mailcode_Commands_IfBase} class.
4
 *
5
 * @package Mailcode
6
 * @subpackage Commands
7
 * @see Mailcode_Commands_IfBase
8
 */
9
10
declare(strict_types=1);
11
12
namespace Mailcode;
13
14
/**
15
 * Abstract base class for IF commands (IF, ELSEIF).
16
 *
17
 * @package Mailcode
18
 * @subpackage Commands
19
 * @author Sebastian Mordziol <[email protected]>
20
 */
21
abstract class Mailcode_Commands_IfBase extends Mailcode_Commands_Command
22
{
23
    const VALIDATION_VARIABLE_MISSING = 49201;
24
    const VALIDATION_CONTAINS_MISSING_SEARCH_TERM = 49202;
25
    const VALIDATION_INVALID_KEYWORD = 49203;
26
    const VALIDATION_OPERAND_MISSING = 49204;
27
    const VALIDATION_OPERAND_NOT_COMPARISON = 49205;
28
    const VALIDATION_INVALID_COMPARISON_TOKEN = 49206;
29
    const VALIDATION_EXPECTED_KEYWORD = 49207;
30
    const VALIDATION_NOTHING_AFTER_OPERAND = 49208;
31
    
32
    const ERROR_NO_VARIABLE_AVAILABLE = 52601;
33
    const ERROR_NO_STRING_LITERAL_AVAILABLE = 52602;
34
    const ERROR_NO_COMPARATOR_AVAILABLE = 52603;
35
    const ERROR_NO_VALUE_AVAILABLE = 52604;
36
    
37
    public function supportsType(): bool
38
    {
39
        return true;
40
    }
41
    
42
    public function requiresParameters(): bool
43
    {
44
        return true;
45
    }
46
    
47
    public function supportsLogicKeywords() : bool
48
    {
49
        return true;
50
    }
51
    
52
    public function isCommand() : bool
53
    {
54
        return $this->type === 'command' || empty($this->type);
55
    }
56
    
57
    public function isVariable() : bool
58
    {
59
        return $this->type === 'variable';
60
    }
61
    
62
    public function isContains() : bool
63
    {
64
        return $this->type === 'contains';
65
    }
66
    
67
    protected function getValidations() : array
68
    {
69
        return array();
70
    }
71
    
72
    public function generatesContent() : bool
73
    {
74
        return false;
75
    }
76
    
77
    public function getSupportedTypes() : array
78
    {
79
        return array(
80
            'variable',
81
            'command',
82
            'contains',
83
            'empty',
84
            'not-empty'
85
        );
86
    }
87
    
88
    public function getDefaultType() : string
89
    {
90
        return 'command';
91
    }
92
}
93