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

namespace IQDEV\ElasticSearch\Facet;

final class FacetKeyword implements Facet
{
    public string $key;
    public $value;
    
    /**
     * @param string $key
     * @param string|string[] $value
     */
    public function __construct(
        string $key,
        $value
    )
    {
        $this->key = $key;
        $this->value = $value;
    }

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