Passed
Push — master ( 174259...689687 )
by Sebastian
04:01
created

Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getNormalized() 0 3 1
A getValue() 0 3 1
A getText() 0 5 1
1
<?php
2
/**
3
 * File containing the {@see Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral} class.
4
 *
5
 * @package Mailcode
6
 * @subpackage Parser
7
 * @see Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral
8
 */
9
10
declare(strict_types=1);
11
12
namespace Mailcode;
13
14
/**
15
 * Token representing a quoted string literal.
16
 *
17
 * @package Mailcode
18
 * @subpackage Parser
19
 * @author Sebastian Mordziol <[email protected]>
20
 */
21
class Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral extends Mailcode_Parser_Statement_Tokenizer_Token implements Mailcode_Parser_Statement_Tokenizer_Type_Value
22
{
23
   /**
24
    * Retrieves the text with the surrounding quotes.
25
    * @return string
26
    */
27
    public function getNormalized() : string
28
    {
29
        return $this->restoreQuotes($this->matchedText);
30
    }
31
    
32
   /**
33
    * Retrieves the text with the surrounding quotes.
34
    * @return string
35
    */
36
    public function getValue() : string
37
    {
38
        return $this->getNormalized();
39
    }
40
    
41
   /**
42
    * Retrieves the text without the surrounding quotes.
43
    * @return string
44
    */
45
    public function getText() : string
46
    {
47
        $quoteless = trim($this->matchedText, '"\'');
48
        
49
        return $this->restoreQuotes($quoteless);
50
    }
51
}
52