Completed
Pull Request — master (#1)
by Woody
27:07 queued 01:07
created

ResolverTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 23
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A resolve() 0 8 2
1
<?php
2
3
namespace Equip\Resolver;
4
5
trait ResolverTrait
6
{
7
    /**
8
     * @var \Relay\ResolverInterface
9
     */
10
    private $resolver;
11
12
    /**
13
     * Resolve a class spec into an object, if it is not already instantiated.
14
     *
15
     * @param string|object $specOrObject
16
     *
17
     * @return object
18
     */
19 4
    private function resolve($specOrObject)
20
    {
21 4
        if (is_object($specOrObject)) {
22 1
            return $specOrObject;
23
        }
24
25 4
        return call_user_func($this->resolver, $specOrObject);
26
    }
27
}
28