SearchQuery_Range   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 46
rs 10
c 0
b 0
f 0
wmc 7

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setStart() 0 4 1
A isFiltered() 0 3 2
A setEnd() 0 4 1
A __construct() 0 4 1
A end() 0 4 1
A start() 0 4 1
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