PreMigrationEvent   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 45
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getLoadedVersions() 0 4 1
A getLoadedVersion() 0 6 2
A setLoadedVersion() 0 4 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