MessagePartStreamReadException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 4
crap 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\Stream;
9
10
use RuntimeException;
11
use ZBateson\MailMimeParser\Message\IMessagePart;
12
13
/**
14
 * Thrown for exceptions on MessagePartStream::read so a $part can be used to
15
 * determine where the exception occurred.
16
 *
17
 * @author Zaahid Bateson
18
 */
19
class MessagePartStreamReadException extends RuntimeException
20
{
21
    /**
22
     * @var IMessagePart the IMessagePart the error was caused on.
23
     */
24
    protected IMessagePart $part;
25
26 2
    public function __construct(IMessagePart $part, string $message = '', int $code = 0, ?\Throwable $previous = null)
27
    {
28 2
        parent::__construct($message, $code, $previous);
29 2
        $this->part = $part;
30
    }
31
32 1
    public function getPart() : IMessagePart
33
    {
34 1
        return $this->part;
35
    }
36
}
37