Skip to content

Commit 5024cab

Browse files
committed
Refactoring
1 parent fe28e2b commit 5024cab

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/Processors/FacetConstraintProcessor.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ class FacetConstraintProcessor extends ConstraintProcessor
1010
{
1111
public function visitRoot(Specification $specification): void
1212
{
13-
$filters = $specification->facets()
14-
->filter(fn (AllowedFacet $facet) => $facet->isActive())
13+
$filters = $specification->activeFacets()
1514
->flatMap(fn (AllowedFacet $facet) => $facet->filters())
1615
->each(fn (AllowedFilter $filter) => $filter->disable());
1716

src/Processors/FacetRequestProcessor.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,11 @@ private function attachAggregate(AllowedFacet $facet, Collection $aggregates): v
7777

7878
$agg = $aggregates->get($facet->name());
7979

80-
$agg !== null
81-
? $facet->attachAggregate($agg)
82-
: throw new AggregateNotFoundException($facet->name());
80+
if ($agg === null) {
81+
throw new AggregateNotFoundException($facet->name());
82+
}
83+
84+
$facet->attachAggregate($agg);
8385
}
8486

8587
private function attachFilters(AllowedFacet $facet, Collection $filters): void

0 commit comments

Comments
 (0)