Passed
Pull Request — develop (#69)
by
unknown
01:26
created

ApplyMigrationPayload::getReindexResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
namespace Nord\Lumen\Elasticsearch\Pipelines\Payloads;
4
5
/**
6
 * Class ApplyMigrationPayload
7
 * @package Nord\Lumen\Elasticsearch\Pipelines\Payloads
8
 */
9
class ApplyMigrationPayload extends MigrationPayload
10
{
11
12
    /**
13
     * @var string
14
     */
15
    private $targetVersionFile;
16
17
    /**
18
     * @var int
19
     */
20
    private $batchSize;
21
22
    /**
23
     * @var int
24
     */
25
    private $numberOfReplicas;
26
27
    /**
28
     * @var array
29
     */
30
    private $reindexResponse;
31
32
    /**
33
     * ApplyMigrationPayload constructor.
34
     *
35
     * @param string $configurationPath
36
     * @param int    $batchSize
37
     */
38
    public function __construct($configurationPath, $batchSize)
39
    {
40
        parent::__construct($configurationPath);
41
42
        $this->batchSize = $batchSize;
43
    }
44
45
    /**
46
     * @param string $targetVersionFile
47
     */
48
    public function setTargetVersionFile($targetVersionFile)
49
    {
50
        $this->targetVersionFile = $targetVersionFile;
51
    }
52
53
    /**
54
     * @return string
55
     */
56
    public function getTargetVersionPath()
57
    {
58
        return sprintf('%s/%s', $this->getIndexVersionsPath(), $this->targetVersionFile);
59
    }
60
61
    /**
62
     * @return array
63
     */
64
    public function getTargetConfiguration()
65
    {
66
        return include $this->getTargetVersionPath();
67
    }
68
69
    /**
70
     * @return string
71
     */
72
    public function getTargetVersionName()
73
    {
74
        return $this->getTargetConfiguration()['index'];
75
    }
76
77
    /**
78
     * @return int
79
     */
80
    public function getBatchSize()
81
    {
82
        return $this->batchSize;
83
    }
84
85
    /**
86
     * @return int
87
     */
88
    public function getNumberOfReplicas()
89
    {
90
        return $this->numberOfReplicas;
91
    }
92
93
    /**
94
     * @param int $numberOfReplicas
95
     */
96
    public function setNumberOfReplicas($numberOfReplicas)
97
    {
98
        $this->numberOfReplicas = $numberOfReplicas;
99
    }
100
101
    /**
102
     * @return array
103
     */
104
    public function getReindexResponse()
105
    {
106
        return $this->reindexResponse;
107
    }
108
109
    /**
110
     * @param array $reindexResponse
111
     */
112
    public function setReindexResponse(array $reindexResponse)
113
    {
114
        $this->reindexResponse = $reindexResponse;
115
    }
116
}
117