buildFullClassName()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 3
eloc 4
nc 2
nop 2
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
    public function __construct(string $argumentName, string $argumentType)
28
    {
29
        $this->argumentName = $argumentName;
30
        $this->argumentType = $argumentType;
31
    }
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
    protected function buildFullClassName($className, $namespace)
42
    {
43
        // Check if we need to append namespace to dependency
44
        if ($className !== null && strpos($className, '\\') === false) {
45
            return $namespace . '\\' . $className;
46
        }
47
48
        return $className;
49
    }
50
}
51