MessagePartStreamReadException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 1
b 0
f 0
dl 0
loc 16
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getPart() 0 3 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