File tree Expand file tree Collapse file tree 1 file changed +29
-5
lines changed
Expand file tree Collapse file tree 1 file changed +29
-5
lines changed Original file line number Diff line number Diff line change @@ -21,16 +21,30 @@ class RangeValue implements \Spameri\ElasticQuery\Entity\EntityInterface
2121 */
2222 private $ to ;
2323
24+ /**
25+ * @var bool
26+ */
27+ private $ fromEqual ;
28+
29+ /**
30+ * @var bool
31+ */
32+ private $ toEqual ;
33+
2434
2535 public function __construct (
26- string $ key
27- , int $ from
28- , int $ to
36+ string $ key ,
37+ int $ from ,
38+ int $ to ,
39+ bool $ fromEqual = TRUE ,
40+ bool $ toEqual = TRUE
2941 )
3042 {
3143 $ this ->key = $ key ;
3244 $ this ->from = $ from ;
3345 $ this ->to = $ to ;
46+ $ this ->fromEqual = $ fromEqual ;
47+ $ this ->toEqual = $ toEqual ;
3448 }
3549
3650
@@ -42,10 +56,20 @@ public function key(): string
4256
4357 public function toArray (): array
4458 {
59+ $ from = $ this ->from ;
60+ $ to = $ this ->to ;
61+
62+ if ( ! $ this ->fromEqual ) {
63+ $ from ++;
64+ }
65+ if ($ this ->toEqual ) {
66+ $ to ++;
67+ }
68+
4569 return [
4670 'key ' => $ this ->key ,
47- 'from ' => $ this -> from ,
48- 'to ' => $ this -> to ,
71+ 'from ' => $ from ,
72+ 'to ' => $ to ,
4973 ];
5074 }
5175
You can’t perform that action at this time.
0 commit comments