PartBuilderFactory::newPartBuilder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 1
c 3
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 2
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\Parser;
9
10
use Psr\Http\Message\StreamInterface;
11
use ZBateson\MailMimeParser\Message\PartHeaderContainer;
12
use ZBateson\MailMimeParser\Parser\Proxy\ParserPartProxy;
13
14
/**
15
 * Responsible for creating PartBuilder instances.
16
 *
17
 * @author Zaahid Bateson
18
 */
19
class PartBuilderFactory
20
{
21
    /**
22
     * Constructs a top-level (message) PartBuilder object and returns it.
23
     */
24 108
    public function newPartBuilder(PartHeaderContainer $headerContainer, StreamInterface $messageStream) : PartBuilder
25
    {
26 108
        return new PartBuilder($headerContainer, $messageStream);
27
    }
28
29
    /**
30
     * Constructs a child PartBuilder object with the passed $parent as its
31
     * parent, and returns it.
32
     */
33 75
    public function newChildPartBuilder(PartHeaderContainer $headerContainer, ParserPartProxy $parent) : PartBuilder
34
    {
35 75
        return new PartBuilder(
36 75
            $headerContainer,
37 75
            null,
38 75
            $parent
39 75
        );
40
    }
41
}
42