PreMigrationEvent::getLoadedVersion()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 6
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
3
namespace RDV\Bundle\MigrationBundle\Event;
4
5
class PreMigrationEvent extends MigrationEvent
6
{
7
    /**
8
     * @var array
9
     *      key   = bundle name
10
     *      value = version
11
     */
12
    protected $loadedVersions = [];
13
14
    /**
15
     * Gets a list of the latest loaded versions for all bundles
16
     *
17
     * @return array
18
     *      key   = bundle name
19
     *      value = version
20
     */
21
    public function getLoadedVersions()
22
    {
23
        return $this->loadedVersions;
24
    }
25
26
    /**
27
     * Gets the latest version loaded version of the given bundle
28
     *
29
     * @param string $bundleName
30
     * @return string|null
31
     */
32
    public function getLoadedVersion($bundleName)
33
    {
34
        return isset($this->loadedVersions[$bundleName])
35
            ? $this->loadedVersions[$bundleName]
36
            : null;
37
    }
38
39
    /**
40
     * Sets a number of already loaded version of the given bundle
41
     *
42
     * @param string $bundleName
43
     * @param string $version
44
     */
45
    public function setLoadedVersion($bundleName, $version)
46
    {
47
        $this->loadedVersions[$bundleName] = $version;
48
    }
49
}
50