Intersect   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 67
c 2
b 0
f 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A partName() 0 4 1
A add() 0 6 1
A getIntersects() 0 4 1
A getTable() 0 4 1
A getWhere() 0 4 1
A where() 0 4 1
1
<?php
2
/**
3
 * Author: Nil Portugués Calderó <[email protected]>
4
 * Date: 9/12/14
5
 * Time: 7:11 PM.
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace NilPortugues\Sql\QueryBuilder\Manipulation;
12
13
use NilPortugues\Sql\QueryBuilder\Syntax\QueryPartInterface;
14
15
/**
16
 * Class Intersect.
17
 */
18
class Intersect implements QueryInterface, QueryPartInterface
19
{
20
    const INTERSECT = 'INTERSECT';
21
22
    /**
23
     * @var array
24
     */
25
    private $intersect = [];
26
27
    /**
28
     * @return string
29
     */
30
    public function partName()
31
    {
32
        return 'INTERSECT';
33
    }
34
35
    /**
36
     * @param Select $select
37
     *
38
     * @return $this
39
     */
40
    public function add(Select $select)
41
    {
42
        $this->intersect[] = $select;
43
44
        return $this;
45
    }
46
47
    /**
48
     * @return array
49
     */
50
    public function getIntersects()
51
    {
52
        return $this->intersect;
53
    }
54
55
    /**
56
     * @throws QueryException
57
     *
58
     * @return \NilPortugues\Sql\QueryBuilder\Syntax\Table
59
     */
60
    public function getTable()
61
    {
62
        throw new QueryException('INTERSECT does not support tables');
63
    }
64
65
    /**
66
     * @throws QueryException
67
     *
68
     * @return \NilPortugues\Sql\QueryBuilder\Syntax\Where
69
     */
70
    public function getWhere()
71
    {
72
        throw new QueryException('INTERSECT does not support WHERE.');
73
    }
74
75
    /**
76
     * @throws QueryException
77
     *
78
     * @return \NilPortugues\Sql\QueryBuilder\Syntax\Where
79
     */
80
    public function where()
81
    {
82
        throw new QueryException('INTERSECT does not support the WHERE statement.');
83
    }
84
}
85