Completed
Push — master ( f56a01...af237a )
by Hong
02:39
created

PreviousTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 45
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setPrevious() 0 5 1
A hasPrevious() 0 4 1
A getPrevious() 0 4 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\PreviousInterface;
18
use Phossa2\Query\Interfaces\StatementInterface;
19
20
/**
21
 * PreviousTrait
22
 *
23
 * Implementation of PreviousInterface
24
 *
25
 * @package Phossa2\Query
26
 * @author  Hong Zhang <[email protected]>
27
 * @see     PreviousInterface
28
 * @version 2.0.0
29
 * @since   2.0.0 added
30
 */
31
trait PreviousTrait
32
{
33
    /**
34
     * Previous statement used in UNION/UNION ALL
35
     *
36
     * @var    StatementInterface
37
     * @access protected
38
     */
39
    protected $previous;
40
41
    /**
42
     * Set previous statement
43
     *
44
     * @param  StatementInterface $previous
45
     * @return $this
46
     * @access public
47
     */
48
    public function setPrevious(StatementInterface $previous = null)
49
    {
50
        $this->previous = $previous;
51
        return $this;
52
    }
53
54
    /**
55
     * Has previous statement
56
     *
57
     * @return bool
58
     * @access public
59
     */
60
    public function hasPrevious()/*# : bool */
61
    {
62
        return null !== $this->previous;
63
    }
64
65
    /**
66
     * Get previous statement
67
     *
68
     * @return StatementInterface
69
     * @access public
70
     */
71
    public function getPrevious()/*# : StatementInterface */
72
    {
73
        return $this->previous;
74
    }
75
}
76