Completed
Push — master ( 96ab8a...466607 )
by Nicolas
03:10
created

ScriptId::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
dl 6
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 4
1
<?php
2
namespace Elastica\Script;
3
4
/**
5
 * Stored script referenced by ID.
6
 *
7
 * @author Tobias Schultze <http://tobion.de>
8
 * @author Martin Janser <[email protected]>
9
 *
10
 * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html
11
 */
12 View Code Duplication
class ScriptId extends AbstractScript
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...
13
{
14
    /**
15
     * @var string
16
     */
17
    private $_scriptId;
18
19
    /**
20
     * @param string      $scriptId   Script ID
21
     * @param array|null  $params
22
     * @param string|null $lang
23
     * @param string|null $documentId Document ID the script action should be performed on (only relevant in update context)
24
     */
25
    public function __construct($scriptId, array $params = null, $lang = null, $documentId = null)
26
    {
27
        parent::__construct($params, $lang, $documentId);
28
29
        $this->setScriptId($scriptId);
30
    }
31
32
    /**
33
     * @param string $scriptId
34
     *
35
     * @return $this
36
     */
37
    public function setScriptId($scriptId)
38
    {
39
        $this->_scriptId = $scriptId;
40
41
        return $this;
42
    }
43
44
    /**
45
     * @return string
46
     */
47
    public function getScriptId()
48
    {
49
        return $this->_scriptId;
50
    }
51
52
    /**
53
     * {@inheritdoc}
54
     */
55
    protected function getScriptTypeArray()
56
    {
57
        return ['id' => $this->_scriptId];
58
    }
59
}
60