Completed
Push — master ( 20f6ff...6a696f )
by Nicolas
03:14
created

Attachment::setField()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
namespace Elastica\Processor;
3
4 View Code Duplication
class Attachment extends AbstractProcessor
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
5
{
6
    /**
7
     * Attachment constructor.
8
     *
9
     * @param string $field
10
     */
11
    public function __construct(string $field)
12
    {
13
        $this->setField($field);
14
    }
15
16
    /**
17
     * Set field.
18
     *
19
     * @param string $field
20
     *
21
     * @return $this
22
     */
23
    public function setField(string $field)
24
    {
25
        return $this->setParam('field', $field);
26
    }
27
28
    /**
29
     * Set target_field. Default attachment.
30
     *
31
     * @param string $targetField
32
     *
33
     * @return $this
34
     */
35
    public function setTargetField(string $targetField)
36
    {
37
        return $this->setParam('target_field', $targetField);
38
    }
39
40
    /**
41
     * Set indexed_chars. Default 100000.
42
     *
43
     * @param int $indexedChars
44
     *
45
     * @return $this
46
     */
47
    public function setIndexedChars(int $indexedChars)
48
    {
49
        return $this->setParam('indexed_chars', $indexedChars);
50
    }
51
52
    /**
53
     * Set properties. Default all properties. Can be content, title, name, author, keywords, date, content_type, content_length, language
54
     *
55
     * @param array $properties
56
     *
57
     * @return $this
58
     */
59
    public function setProperties(array $properties)
60
    {
61
        return $this->setParam('properties', $properties);
62
    }
63
64
    /**
65
     * Set ignore_missing. Default false.
66
     *
67
     * @param bool $ignoreMissing
68
     *
69
     * @return $this
70
     */
71
    public function setIgnoreMissing(bool $ignoreMissing)
72
    {
73
        return $this->setParam('ignore_missing', $ignoreMissing);
74
    }
75
}