InjectDoctrine   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 21
wmc 2
lcom 0
cbo 2
ccs 5
cts 5
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getValue() 0 10 2
1
<?php
2
namespace mxdiModule\Annotation;
3
4
use mxdiModule\Exception\CannotGetValue;
5
use Zend\ServiceManager\ServiceLocatorInterface;
6
7
/**
8
 * @Annotation
9
 * @Target({"PROPERTY", "ANNOTATION", "METHOD"})
10
 */
11
final class InjectDoctrine implements AnnotationInterface
12
{
13
    /**
14
     * Get the value.
15
     *
16
     * @param ServiceLocatorInterface|null $sm
17
     * @return object
18
     *
19
     * @throws CannotGetValue
20
     */
21 2
    public function getValue(ServiceLocatorInterface $sm)
22
    {
23 2
        $name = 'Doctrine\ORM\EntityManager';
24
25
        try {
26 2
            return $sm->get($name);
27 1
        } catch (\Exception $e) {
28 1
            throw CannotGetValue::of($name, $e);
29
        }
30
    }
31
}
32