UnionAll::mainQuery()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace mav3rick177\RapidPagination\Base\Query;
4
5
/**
6
 * Class UnionAll
7
 */
8
class UnionAll extends SelectOrUnionAll implements \IteratorAggregate
9
{
10
    /**
11
     * @var Select
12
     */
13
    protected $mainQuery;
14
15
    /**
16
     * @var Select
17
     */
18
    protected $supportQuery;
19
20
    /**
21
     * UnionAll constructor.
22
     *
23
     * @param Select $select
24
     */
25 10
    public function __construct(Select $select)
26
    {
27 10
        $this->mainQuery = $select;
28 10
        $this->supportQuery = $select->inverse();
29
    }
30
31
    /**
32
     * @return Select
33
     */
34 10
    public function mainQuery()
35
    {
36 10
        return $this->mainQuery;
37
    }
38
39
    /**
40
     * @return Select
41
     */
42 10
    public function supportQuery()
43
    {
44 10
        return $this->supportQuery;
45
    }
46
47
    /**
48
     * Clone Select.
49
     */
50
    public function __clone()
51
    {
52
        $this->mainQuery = clone $this->mainQuery;
53
        $this->supportQuery = clone $this->supportQuery;
54
    }
55
56
    /**
57
     * Retrieve an external iterator.
58
     *
59
     * @return \ArrayIterator|Select[]
60
     */
61
    public function getIterator()
62
    {
63
        return new \ArrayIterator([$this->mainQuery, $this->supportQuery]);
64
    }
65
}
66