SearchQuery_Range::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SilverStripe\FullTextSearch\Search\Queries;
4
5
use SilverStripe\Dev\Deprecation;
6
7
/**
8
 * Create one of these and pass as one of the values in filter or exclude to filter or exclude by a (possibly
9
 * open ended) range
10
 */
11
class SearchQuery_Range
12
{
13
    public $start = null;
14
    public $end = null;
15
16
    public function __construct($start = null, $end = null)
17
    {
18
        $this->start = $start;
19
        $this->end = $end;
20
    }
21
22
    public function setStart($start)
23
    {
24
        $this->start = $start;
25
        return $this;
26
    }
27
28
    public function setEnd($end)
29
    {
30
        $this->end = $end;
31
        return $this;
32
    }
33
34
    public function isFiltered()
35
    {
36
        return $this->start !== null || $this->end !== null;
37
    }
38
39
    /**
40
     * @deprecated
41
     * @codeCoverageIgnore
42
     */
43
    public function start($start)
44
    {
45
        Deprecation::notice('4.0', 'Use setStart() instead');
46
        return $this->setStart($start);
47
    }
48
49
    /**
50
     * @deprecated
51
     * @codeCoverageIgnore
52
     */
53
    public function end($end)
54
    {
55
        Deprecation::notice('4.0', 'Use setEnd() instead');
56
        return $this->setEnd($end);
57
    }
58
}
59