<?php

namespace App\Modules\Shared\Domain\Criteria;

class Specify implements Criteria
{
    public function __construct(private Specification $specification)
    {
    }

    public function meetCriteria(array $data): array
    {
        return array_values(array_filter($data, fn ($element) => $this->specification->isSatisfiedBy($element)));
    }
}
