Completed
Push — master ( 461219...630231 )
by Harry
04:03
created

BuilderTrait::getBuilder()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
crap 2
1
<?php
2
/**
3
 * This file is part of graze/data-file
4
 *
5
 * Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license https://github.com/graze/data-file/blob/master/LICENSE.md
11
 * @link    https://github.com/graze/data-file
12
 */
13
14
namespace Graze\DataFile\Helper\Builder;
15
16
trait BuilderTrait
17
{
18
    /**
19
     * @var BuilderInterface
20
     */
21
    protected $builder;
22
23
    /**
24
     * @param BuilderInterface $builder
25
     *
26
     * @return $this
27
     */
28 81
    public function setBuilder(BuilderInterface $builder)
29
    {
30 81
        $this->builder = $builder;
31
32 81
        return $this;
33
    }
34
35
    /**
36
     * @return BuilderInterface
37
     */
38 73
    public function getBuilder()
39
    {
40 73
        if (!$this->builder) {
41 19
            $this->builder = new Builder();
42
        }
43
44 73
        return $this->builder;
45
    }
46
}
47