EnvLoader   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 50 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A loadInto() 6 9 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
namespace Desmond\functions;
3
use Desmond\Environment;
4
5
class EnvLoader
6
{
7 334
    public static function loadInto(Environment $env, $functionDir)
8
    {
9 334 View Code Duplication
        foreach (FileOperations::getFunctionFiles() as $file) {
10 334
            $class = sprintf('Desmond\\functions\\%s\\%s',
11 334
                $functionDir, substr($file, 0, -4));
12 334
            $function = new $class;
13 334
            $env->set($function->id(), $function);
14
        }
15 334
    }
16
}
17