CallableDefinition   A
last analyzed

Coupling/Cohesion

Components 1
Dependencies 1

Complexity

Total Complexity 5

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 19
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B build() 0 13 5
1
<?php
2
3
namespace League\Container\Definition;
4
5
class CallableDefinition extends AbstractDefinition
0 ignored issues
show
Bug introduced by Andreas Möller
There is one abstract method getContainer in this class; you could implement it, or declare this class as abstract.
Loading history...
6
{
7
    /**
8
     * {@inheritdoc}
9
     */
10 48
    public function build(array $args = [])
11
    {
12 48
        $args     = (empty($args)) ? $this->arguments : $args;
13 48
        $resolved = $this->resolveArguments($args);
14
15 48
        if (is_array($this->concrete) && is_string($this->concrete[0])) {
16 6
            $this->concrete[0] = ($this->getContainer()->has($this->concrete[0]))
17 6
                               ? $this->getContainer()->get($this->concrete[0])
18 6
                               : $this->concrete[0];
19 6
        }
20
21 48
        return call_user_func_array($this->concrete, $resolved);
22
    }
23
}
24