Completed
Pull Request — develop (#39)
by Sam
02:08
created

CreateMigrationPayload::getVersionPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
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 CreateMigrationPayload
7
 * @package Nord\Lumen\Elasticsearch\Pipelines\Payloads
8
 */
9
class CreateMigrationPayload extends MigrationPayload
10
{
11
12
    /**
13
     * @var int
14
     */
15
    protected $versionName;
16
17
    /**
18
     * IndexMigrationPayload constructor.
19
     *
20
     * @param string $configurationPath
21
     */
22
    public function __construct($configurationPath)
23
    {
24
        parent::__construct($configurationPath);
25
26
        // Determine the index name
27
        $this->versionName = time();
28
    }
29
30
    /**
31
     * @return string
32
     */
33
    public function getVersionPath()
34
    {
35
        return sprintf('%s/%d.php', $this->getIndexVersionsPath(), $this->getVersionName());
36
    }
37
38
    /**
39
     * @return int
40
     */
41
    public function getVersionName()
42
    {
43
        return $this->versionName;
44
    }
45
46
    public function getIndexVersionName()
47
    {
48
        return sprintf('%s_%d', $this->getIndexName(), $this->getVersionName());
49
    }
50
}
51