Completed
Push — master ( 882947...a4a53d )
by Mike
13:52 queued 13:46
created

JsonConfiguration   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 68.75 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 11
loc 16
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A doLoad() 10 10 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Doctrine\DBAL\Migrations\Configuration;
4
5
/**
6
 * Load migration configuration information from a PHP configuration file.
7
 *
8
 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
9
 * @link        www.doctrine-project.org
10
 * @since       2.0
11
 * @author      David Havl <[email protected]>
12
 */
13
class JsonConfiguration extends AbstractFileConfiguration
14
{
15
    /**
16
     * @inheritdoc
17
     */
18 19 View Code Duplication
    protected function doLoad($file)
19
    {
20 19
        $config = json_decode(file_get_contents($file), true);
21
22 19
        if (isset($config['migrations_directory'])) {
23 12
            $config['migrations_directory'] = $this->getDirectoryRelativeToFile($file, $config['migrations_directory']);
24
        }
25
26 19
        $this->setConfiguration($config);
27 16
    }
28
}
29