Completed
Push — master ( daa27a...019907 )
by Vitaly
03:25
created

InjectableAbstractConfigurator   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 23.68 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 9
loc 38
ccs 8
cts 8
cp 1
rs 10
c 2
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A buildFullClassName() 9 9 3

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 declare(strict_types = 1);
2
/**
3
 * Created by Vitaly Iegorov <[email protected]>.
4
 * on 07.08.16 at 15:46
5
 */
6
namespace samsonframework\container\configurator;
7
8
/**
9
 * Abstract injection configurator.
10
 *
11
 * @author Vitaly Egorov <[email protected]>
12
 */
13
abstract class InjectableAbstractConfigurator
14
{
15
    /** @var string Method argument name */
16
    protected $argumentName;
17
18
    /** @var string Method argument type */
19
    protected $argumentType;
20
21
    /**
22
     * InjectArgument constructor.
23
     *
24
     * @param string $argumentName Injected argument name
25
     * @param string $argumentType Injected argument type hint
26
     */
27 14
    public function __construct(string $argumentName, string $argumentType)
28
    {
29 14
        $this->argumentName = $argumentName;
30 14
        $this->argumentType = $argumentType;
31 14
    }
32
33
    /**
34
     * Build full class name.
35
     *
36
     * @param string $className Full or short class name
37
     * @param string $namespace Name space
38
     *
39
     * @return string Full class name
40
     */
41 11 View Code Duplication
    protected function buildFullClassName($className, $namespace)
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...
42
    {
43
        // Check if we need to append namespace to dependency
44 11
        if ($className !== null && strpos($className, '\\') === false) {
45 10
            return $namespace . '\\' . $className;
46
        }
47
48 1
        return $className;
49
    }
50
}
51