1<?php
2
3namespace Elastica\Processor;
4
5/**
6 * Elastica Split Processor.
7 *
8 * @author Federico Panini <fpanini@gmail.com>
9 *
10 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/split-processor.html
11 */
12class Split extends AbstractProcessor
13{
14    const DEFAULT_IGNORE_MISSING_VALUE = false;
15
16    /**
17     * Split constructor.
18     *
19     * @param string $field
20     * @param string $separator
21     */
22    public function __construct(string $field, string $separator)
23    {
24        $this->setField($field);
25        $this->setSeparator($separator);
26    }
27
28    /**
29     * Set the field.
30     *
31     * @param string $field
32     *
33     * @return $this
34     */
35    public function setField(string $field): self
36    {
37        return $this->setParam('field', $field);
38    }
39
40    /**
41     * Set the separator.
42     *
43     * @param string $separator
44     *
45     * @return $this
46     */
47    public function setSeparator(string $separator): self
48    {
49        return $this->setParam('separator', $separator);
50    }
51
52    /**
53     * Set ignore_missing. Default value false.
54     *
55     * @param bool $ignoreMissing only these values are allowed (integer|float|string|boolean|auto)
56     *
57     * @return $this
58     */
59    public function setIgnoreMissing(bool $ignoreMissing): self
60    {
61        return $this->setParam('ignore_missing', $ignoreMissing);
62    }
63}
64