Passed
Push — master ( 2f714f...1c67eb )
by Sebastian
02:15
created

Mailcode_Parser_Statement_Tokenizer_Token::getID()   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
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
/**
3
 * File containing the {@see Mailcode_Parser_Statement_Tokenizer_Token} class.
4
 *
5
 * @package Mailcode
6
 * @subpackage Parser
7
 * @see Mailcode_Parser_Statement_Tokenizer_Token
8
 */
9
10
declare(strict_types=1);
11
12
namespace Mailcode;
13
14
/**
15
 * Abstract base class for a single token in a statement.
16
 *
17
 * @package Mailcode
18
 * @subpackage Parser
19
 * @author Sebastian Mordziol <[email protected]>
20
 */
21
abstract class Mailcode_Parser_Statement_Tokenizer_Token
22
{
23
   /**
24
    * @var string
25
    */
26
    protected $tokenID;
27
    
28
   /**
29
    * @var string
30
    */
31
    protected $matchedText;
32
    
33
   /**
34
    * @var mixed
35
    */
36
    protected $subject;
37
    
38
   /**
39
    * @param string $tokenID
40
    * @param string $matchedText
41
    * @param mixed $subject
42
    */
43
    public function __construct(string $tokenID, string $matchedText, $subject=null)
44
    {
45
        $this->tokenID = $tokenID;
46
        $this->matchedText = $matchedText;
47
        $this->subject = $subject;
48
    }
49
    
50
    public function getID() : string
51
    {
52
        return $this->tokenID;
53
    }
54
    
55
    public function getMatchedText() : string
56
    {
57
        return $this->matchedText;
58
    }
59
    
60
    protected function restoreQuotes(string $subject) : string
61
    {
62
        return str_replace('__QUOTE__', '\"', $subject);
63
    }
64
    
65
    abstract public function getNormalized() : string;
66
}
67