ParserNonMimeMessageProxy   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 91
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
eloc 17
c 1
b 0
f 0
dl 0
loc 91
ccs 20
cts 20
cp 1
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getNextPartMode() 0 3 1
A getNextPartFilename() 0 3 1
A getNextPartStart() 0 3 1
A setNextPartFilename() 0 4 1
A setNextPartMode() 0 4 1
A clearNextPart() 0 6 1
A setNextPartStart() 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
8
namespace ZBateson\MailMimeParser\Parser\Proxy;
9
10
/**
11
 * A bi-directional parser-to-part proxy for IMessage objects created by
12
 * NonMimeParser.
13
 *
14
 * @author Zaahid Bateson
15
 */
16
class ParserNonMimeMessageProxy extends ParserMessageProxy
17
{
18
    /**
19
     * @var ?int The next part's start position within the message's raw stream
20
     *      or null if not set, not discovered, or there are no more parts.
21
     */
22
    protected ?int $nextPartStart = null;
23
24
    /**
25
     * @var ?int The next part's unix file mode in a uu-encoded 'begin' line if
26
     *      exists, or null otherwise.
27
     */
28
    protected ?int $nextPartMode = null;
29
30
    /**
31
     * @var ?string The next part's file name in a uu-encoded 'begin' line if
32
     *      exists, or null otherwise.
33
     */
34
    protected ?string $nextPartFilename = null;
35
36
    /**
37
     * Returns the next part's start position within the message's raw stream,
38
     * or null if not set, not discovered, or there are no more parts under this
39
     * message.
40
     *
41
     * @return int|null The start position or null
42
     */
43 6
    public function getNextPartStart() : ?int
44
    {
45 6
        return $this->nextPartStart;
46
    }
47
48
    /**
49
     * Returns the next part's unix file mode in a uu-encoded 'begin' line if
50
     * one exists, or null otherwise.
51
     *
52
     * @return int|null The file mode or null
53
     */
54 5
    public function getNextPartMode() : ?int
55
    {
56 5
        return $this->nextPartMode;
57
    }
58
59
    /**
60
     * Returns the next part's filename in a uu-encoded 'begin' line if one
61
     * exists, or null otherwise.
62
     *
63
     * @return string|null The file name or null
64
     */
65 5
    public function getNextPartFilename() : ?string
66
    {
67 5
        return $this->nextPartFilename;
68
    }
69
70
    /**
71
     * Sets the next part's start position within the message's raw stream.
72
     */
73 5
    public function setNextPartStart(int $nextPartStart) : static
74
    {
75 5
        $this->nextPartStart = $nextPartStart;
76 5
        return $this;
77
    }
78
79
    /**
80
     * Sets the next part's unix file mode from its 'begin' line.
81
     */
82 5
    public function setNextPartMode(int $nextPartMode) : static
83
    {
84 5
        $this->nextPartMode = $nextPartMode;
85 5
        return $this;
86
    }
87
88
    /**
89
     * Sets the next part's filename from its 'begin' line.
90
     *
91
     */
92 5
    public function setNextPartFilename(string $nextPartFilename) : static
93
    {
94 5
        $this->nextPartFilename = $nextPartFilename;
95 5
        return $this;
96
    }
97
98
    /**
99
     * Sets the next part start position, file mode, and filename to null
100
     */
101 4
    public function clearNextPart() : static
102
    {
103 4
        $this->nextPartStart = null;
104 4
        $this->nextPartMode = null;
105 4
        $this->nextPartFilename = null;
106 4
        return $this;
107
    }
108
}
109