BuilderAwareTrait::setBuilder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
/**
3
 * Phossa Project
4
 *
5
 * PHP version 5.4
6
 *
7
 * @category  Library
8
 * @package   Phossa2\Query
9
 * @copyright Copyright (c) 2016 phossa.com
10
 * @license   http://mit-license.org/ MIT License
11
 * @link      http://www.phossa.com/
12
 */
13
/*# declare(strict_types=1); */
14
15
namespace Phossa2\Query\Traits;
16
17
use Phossa2\Query\Interfaces\BuilderInterface;
18
use Phossa2\Query\Interfaces\BuilderAwareInterface;
19
20
/**
21
 * BuilderAwareTrait
22
 *
23
 * @package Phossa2\Query
24
 * @author  Hong Zhang <[email protected]>
25
 * @see     BuilderAwareInterface
26
 * @version 2.0.1
27
 * @since   2.0.0 added
28
 * @since   2.0.1 changed setBuilder() signature
29
 */
30
trait BuilderAwareTrait
31
{
32
    /**
33
     * @var    BuilderInterface
34
     * @access protected
35
     */
36
    protected $builder;
37
38
    /**
39
     * {@inheritDoc}
40
     *
41
     * @since  2.0.1 able to set NULL
42
     */
43
    public function setBuilder(BuilderInterface $builder = null)
44
    {
45
        $this->builder = $builder;
46
        return $this;
47
    }
48
49
    /**
50
     * {@inheritDoc}
51
     */
52
    public function getBuilder()/*# : BuilderInterface */
53
    {
54
        return $this->builder;
55
    }
56
}
57