Skip to content

Commit 8770e2e

Browse files
committed
Add setReverse on TasksQuery
1 parent ff24520 commit 8770e2e

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/Contracts/TasksQuery.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ class TasksQuery
2222
*/
2323
private ?array $canceledBy = null;
2424

25+
/**
26+
* @var bool|null
27+
*/
28+
private ?bool $reverse = null;
29+
2530
/**
2631
* @return $this
2732
*/
@@ -54,6 +59,16 @@ public function setLimit(int $limit): self
5459
return $this;
5560
}
5661

62+
/**
63+
* @return $this
64+
*/
65+
public function setReverse(bool $reverse): self
66+
{
67+
$this->reverse = $reverse;
68+
69+
return $this;
70+
}
71+
5772
public function toArray(): array
5873
{
5974
return array_filter(
@@ -63,6 +78,7 @@ public function toArray(): array
6378
'from' => $this->from,
6479
'limit' => $this->limit,
6580
'canceledBy' => $this->formatArray($this->canceledBy),
81+
'reverse' => $this->reverse,
6682
]
6783
), static function ($item) { return null !== $item; }
6884
);

tests/Contracts/TasksQueryTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,11 @@ public function testSetFrom(): void
109109

110110
self::assertSame(['from' => 1], $data->toArray());
111111
}
112+
113+
public function testSetReverse(): void
114+
{
115+
$data = (new TasksQuery())->setReverse(true);
116+
117+
self::assertSame(['reverse' => true], $data->toArray());
118+
}
112119
}

0 commit comments

Comments
 (0)