Skip to content

Commit ad3fe6e

Browse files
committed
Where Query connector callback reworked as closure
1 parent 572d7bd commit ad3fe6e

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/IMAP/Query/WhereQuery.php

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,23 +78,27 @@ public function where($criteria, $value = null){
7878
}
7979

8080
/**
81-
* @param mixed $value
81+
* @param \Closure $closure
8282
*
83-
* @return WhereQuery
84-
* @throws InvalidWhereQueryCriteriaException
83+
* @return $this
8584
*/
86-
public function orWhere($value){
87-
return $this->where('OR', $value);
85+
public function orWhere(\Closure $closure = null){
86+
$this->query->push(['OR']);
87+
if($closure !== null) $closure($this);
88+
89+
return $this;
8890
}
8991

9092
/**
91-
* @param mixed $value
93+
* @param \Closure $closure
9294
*
93-
* @return WhereQuery
94-
* @throws InvalidWhereQueryCriteriaException
95+
* @return $this
9596
*/
96-
public function andWhere($value){
97-
return $this->where('AND', $value);
97+
public function andWhere(\Closure $closure = null) {
98+
$this->query->push(['AND']);
99+
if($closure !== null) $closure($this);
100+
101+
return $this;
98102
}
99103

100104
/**

0 commit comments

Comments
 (0)