Completed
Push — master ( 6343d0...45320b )
by Bernhard
06:10
created

ModuleFile10To20Migration::down()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 11
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 11
loc 11
ccs 0
cts 7
cp 0
rs 9.4285
cc 2
eloc 6
nc 2
nop 1
crap 6
1
<?php
2
3
/*
4
 * This file is part of the webmozart/json package.
5
 *
6
 * (c) Bernhard Schussek <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Puli\Manager\Module\Migration;
13
14
use Puli\Manager\Module\ModuleFileConverter;
15
use stdClass;
16
use Webmozart\Json\Migration\JsonMigration;
17
18
/**
19
 * @since  1.0
20
 *
21
 * @author Bernhard Schussek <[email protected]>
22
 */
23
class ModuleFile10To20Migration implements JsonMigration
24
{
25 26
    public function getSourceVersion()
26
    {
27 26
        return '1.0';
28
    }
29
30 26
    public function getTargetVersion()
31
    {
32 26
        return '2.0';
33
    }
34
35 26 View Code Duplication
    public function up(stdClass $data)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
36
    {
37 26
        $data->{'$schema'} = sprintf(ModuleFileConverter::SCHEMA, '2.0');
38
39 26
        unset($data->version);
40
41 26
        if (isset($data->packages)) {
42 26
            $data->modules = $data->packages;
43 26
            unset($data->packages);
44
        }
45 26
    }
46
47 View Code Duplication
    public function down(stdClass $data)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
48
    {
49
        unset($data->{'$schema'});
50
51
        $data->version = '1.0';
52
53
        if (isset($data->modules)) {
54
            $data->packages = $data->modules;
55
            unset($data->modules);
56
        }
57
    }
58
}
59