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

Attachment   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 72
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 72
loc 72
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 4 4 1
A setField() 4 4 1
A setTargetField() 4 4 1
A setIndexedChars() 4 4 1
A setProperties() 4 4 1
A setIgnoreMissing() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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
}