Completed
Push — 1.0.0 ( 608796...a0ab23 )
by Zaahid
04:48
created

PartBuilderFactory::newPartBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
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\Message\Part\Factory;
8
9
use ZBateson\MailMimeParser\Header\HeaderFactory;
10
use ZBateson\MailMimeParser\Message\Part\PartBuilder;
11
12
/**
13
 * Responsible for creating PartBuilder instances.
14
 * 
15
 * The PartBuilder instance must be constructed with a MessagePartFactory
16
 * instance to construct a MessagePart sub-class after parsing a message into
17
 * PartBuilder instances.
18
 *
19
 * @author Zaahid Bateson
20
 */
21
class PartBuilderFactory
22
{
23
    /**
24
     * @var \ZBateson\MailMimeParser\Header\HeaderFactory the HeaderFactory
25
     *      instance
26
     */
27
    protected $headerFactory;
28
    
29
    /**
30
     * Initializes dependencies
31
     * 
32
     * @param HeaderFactory $headerFactory
33
     */
34 1
    public function __construct(HeaderFactory $headerFactory)
35
    {
36 1
        $this->headerFactory = $headerFactory;
37 1
    }
38
    
39
    /**
40
     * Constructs a new PartBuilder object and returns it
41
     * 
42
     * @param \ZBateson\MailMimeParser\Message\Part\Factory\MessagePartFactory
43
     *        $messagePartFactory 
44
     * @return \ZBateson\MailMimeParser\Message\Part\PartBuilder
45
     */
46 1
    public function newPartBuilder(MessagePartFactory $messagePartFactory)
47
    {
48 1
        return new PartBuilder(
49 1
            $this->headerFactory,
50 1
            $messagePartFactory
51
        );
52
    }
53
}
54