Completed
Push — develop ( 1d24d0...76e78e )
by Sam
12s
created

ApplyMigrationPayload::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 2
nc 1
nop 2
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
     * ApplyMigrationPayload constructor.
24
     *
25
     * @param string $configurationPath
26
     * @param int    $batchSize
27
     */
28
    public function __construct($configurationPath, $batchSize)
29
    {
30
        parent::__construct($configurationPath);
31
32
        $this->batchSize = $batchSize;
33
    }
34
35
    /**
36
     * @param string $targetVersionFile
37
     */
38
    public function setTargetVersionFile($targetVersionFile)
39
    {
40
        $this->targetVersionFile = $targetVersionFile;
41
    }
42
43
    /**
44
     * @return string
45
     */
46
    public function getTargetVersionPath()
47
    {
48
        return sprintf('%s/%s', $this->getIndexVersionsPath(), $this->targetVersionFile);
49
    }
50
51
    /**
52
     * @return array
53
     */
54
    public function getTargetConfiguration()
55
    {
56
        return include $this->getTargetVersionPath();
57
    }
58
59
    /**
60
     * @return string
61
     */
62
    public function getTargetVersionName()
63
    {
64
        return $this->getTargetConfiguration()['index'];
65
    }
66
67
    /**
68
     * @return int
69
     */
70
    public function getBatchSize()
71
    {
72
        return $this->batchSize;
73
    }
74
}
75