Completed
Pull Request — develop (#57)
by Sam
01:36
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
     * @param string $targetVersionFile
19
     */
20
    public function setTargetVersionFile($targetVersionFile)
21
    {
22
        $this->targetVersionFile = $targetVersionFile;
23
    }
24
25
    /**
26
     * @return string
27
     */
28
    public function getTargetVersionPath()
29
    {
30
        return sprintf('%s/%s', $this->getIndexVersionsPath(), $this->targetVersionFile);
31
    }
32
33
    /**
34
     * @return array
35
     */
36
    public function getTargetConfiguration()
37
    {
38
        return include $this->getTargetVersionPath();
39
    }
40
41
    /**
42
     * @return string
43
     */
44
    public function getTargetVersionName()
45
    {
46
        return $this->getTargetConfiguration()['index'];
47
    }
48
}
49