AbstractDefinition   A
last analyzed

Coupling/Cohesion

Components 1
Dependencies 1

Complexity

Total Complexity 4

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 54
c 0
b 0
f 0
wmc 4
lcom 1
cbo 1
ccs 12
cts 12
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A withArgument() 0 6 1
A __construct() 0 5 1
A withArguments() 0 8 2
1
<?php
2
3
namespace League\Container\Definition;
4
5
use League\Container\Argument\ArgumentResolverInterface;
6
use League\Container\Argument\ArgumentResolverTrait;
7
use League\Container\ImmutableContainerAwareTrait;
8
9
abstract class AbstractDefinition implements ArgumentResolverInterface, DefinitionInterface
10
{
11
    use ArgumentResolverTrait;
12
    use ImmutableContainerAwareTrait;
13
14
    /**
15
     * @var string
16
     */
17
    protected $alias;
18
19
    /**
20
     * @var mixed
21
     */
22
    protected $concrete;
23
24
    /**
25
     * @var array
26
     */
27
    protected $arguments = [];
28
29
    /**
30
     * Constructor.
31
     *
32
     * @param string $alias
33
     * @param mixed  $concrete
34
     */
35 78
    public function __construct($alias, $concrete)
36
    {
37 78
        $this->alias     = $alias;
38 78
        $this->concrete  = $concrete;
39 78
    }
40
41
    /**
42
     * [email protected]}
43
     */
44 30
    public function withArgument($arg)
45
    {
46 30
        $this->arguments[] = $arg;
47
48 30
        return $this;
49
    }
50
51
    /**
52
     * [email protected]}
53
     */
54 3
    public function withArguments(array $args)
55
    {
56 3
        foreach ($args as $arg) {
57 3
            $this->withArgument($arg);
58 3
        }
59
60 3
        return $this;
61
    }
62
}
63