1<?php
2
3namespace Elastica\Processor;
4
5/**
6 * Elastica Set Processor.
7 *
8 * @author Federico Panini <fpanini@gmail.com>
9 *
10 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/set-processor.html
11 */
12class Set extends AbstractProcessor
13{
14    const DEFAULT_OVERRIDE_VALUE = true;
15
16    /**
17     * Set constructor.
18     *
19     * @param string $field field name
20     * @param string $value field value
21     */
22    public function __construct(string $field, string $value)
23    {
24        $this->setField($field);
25        $this->setValue($value);
26    }
27
28    /**
29     * Set 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 field value.
42     *
43     * @param string $value
44     *
45     * @return $this
46     */
47    public function setValue(string $value): self
48    {
49        return $this->setParam('value', $value);
50    }
51
52    /**
53     * Set override. Default true.
54     *
55     * @param bool $override
56     *
57     * @return $this
58     */
59    public function setOverride(bool $override): self
60    {
61        return $this->setParam('override', $override);
62    }
63}
64