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

ApplyMigrationPayload   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
dl 0
loc 64
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getTargetVersionPath() 0 3 1
A setTargetVersionFile() 0 3 1
A __construct() 0 5 1
A getBatchSize() 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
     * @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