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

PartBuilderFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 30
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A newPartBuilder() 0 5 1
A __construct() 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
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