Completed
Push — develop ( bdcd74...c796db )
by Sam
13s
created

ApplyMigrationPayload::getNumberOfReplicas()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 3
rs 10
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
     * ApplyMigrationPayload constructor.
29
     *
30
     * @param string $configurationPath
31
     * @param int    $batchSize
32
     */
33
    public function __construct($configurationPath, $batchSize)
34
    {
35
        parent::__construct($configurationPath);
36
37
        $this->batchSize = $batchSize;
38
    }
39
40
    /**
41
     * @param string $targetVersionFile
42
     */
43
    public function setTargetVersionFile($targetVersionFile)
44
    {
45
        $this->targetVersionFile = $targetVersionFile;
46
    }
47
48
    /**
49
     * @return string
50
     */
51
    public function getTargetVersionPath()
52
    {
53
        return sprintf('%s/%s', $this->getIndexVersionsPath(), $this->targetVersionFile);
54
    }
55
56
    /**
57
     * @return array
58
     */
59
    public function getTargetConfiguration()
60
    {
61
        return include $this->getTargetVersionPath();
62
    }
63
64
    /**
65
     * @return string
66
     */
67
    public function getTargetVersionName()
68
    {
69
        return $this->getTargetConfiguration()['index'];
70
    }
71
72
    /**
73
     * @return int
74
     */
75
    public function getBatchSize()
76
    {
77
        return $this->batchSize;
78
    }
79
80
    /**
81
     * @return int
82
     */
83
    public function getNumberOfReplicas()
84
    {
85
        return $this->numberOfReplicas;
86
    }
87
88
    /**
89
     * @param int $numberOfReplicas
90
     */
91
    public function setNumberOfReplicas($numberOfReplicas)
92
    {
93
        $this->numberOfReplicas = $numberOfReplicas;
94
    }
95
}
96