Completed
Pull Request — develop (#57)
by Sam
01:36
created

ApplyMigrationPayload   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
dl 0
loc 38
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getTargetVersionPath() 0 3 1
A setTargetVersionFile() 0 3 1
A getTargetConfiguration() 0 3 1
A getTargetVersionName() 0 3 1
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