Completed
Push — master ( ab502e...07a33d )
by Zaahid
06:14
created

Token   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 1 Features 1
Metric Value
wmc 4
c 3
b 1
f 1
lcom 1
cbo 1
dl 0
loc 42
ccs 9
cts 9
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A isSpace() 0 4 1
A ignoreSpacesBefore() 0 4 1
A ignoreSpacesAfter() 0 4 1
1
<?php
2
/**
3
 * This file is part of the ZBateson\MailMimeParser project.
4
 *
5
 * @license http://opensource.org/licenses/bsd-license.php BSD
6
 */
7
namespace ZBateson\MailMimeParser\Header\Part;
8
9
use ZBateson\MailMimeParser\Header\Part\HeaderPart;
10
11
/**
12
 * Holds a string value token that will require additional processing by a
13
 * consumer prior to returning to a client.
14
 * 
15
 * A Token is meant to hold a value for further processing -- for instance when
16
 * consuming an address list header (like From or To) -- before it's known what
17
 * type of HeaderPart it is (could be an email address, could be a name, or
18
 * could be a group.)
19
 *
20
 * @author Zaahid Bateson
21
 */
22
class Token extends HeaderPart
23
{
24
    /**
25
     * Initializes a token.
26
     * 
27
     * @param string $value the token's value
28
     */
29 3
    public function __construct($value)
30
    {
31 3
        $this->value = $value;
32 3
    }
33
    
34
    /**
35
     * Returns true if the value of the token is equal to a single space.
36
     * 
37
     * @return bool
38
     */
39 2
    public function isSpace()
40
    {
41 2
        return ($this->value === ' ');
42
    }
43
    
44
    /**
45
     * Returns true if the value is a space.
46
     * 
47
     * @return bool
48
     */
49 2
    public function ignoreSpacesBefore()
50
    {
51 2
        return $this->isSpace();
52
    }
53
    
54
    /**
55
     * Returns true if the value is a space.
56
     * 
57
     * @return bool
58
     */
59 2
    public function ignoreSpacesAfter()
60
    {
61 2
        return $this->isSpace();
62
    }
63
}
64