Skip to content
Snippets Groups Projects
FacetKeyword.php 501 B
Newer Older
Pavel's avatar
Pavel committed
<?php

namespace IQDEV\ElasticSearch\Facet;

final class FacetKeyword implements Facet
{
Pavel's avatar
Pavel committed
    private string $key;
    /** @var string|string[] */
    private $value;

Pavel's avatar
Pavel committed
    /**
     * @param string|string[] $value
     */
Pavel's avatar
Pavel committed
    public function __construct(string $key, $value)
Pavel's avatar
Pavel committed
    {
        $this->key = $key;
        $this->value = $value;
    }

    public function es(): array
    {
        return [
            'facet_code' => $this->key,
            'facet_value' => $this->value,
        ];
    }
Pavel's avatar
Pavel committed
}