AnnotationDriver   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A loadMetadataForClass() 0 13 3
1
<?php
2
/**
3
 * This file is part of the Cubiche package.
4
 *
5
 * Copyright (c) Cubiche
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace Cubiche\Domain\EventSourcing\Metadata\Driver;
11
12
use Cubiche\Core\Metadata\Driver\AbstractAnnotationDriver;
13
use Cubiche\Domain\EventSourcing\Metadata\Annotations\Migratable;
14
use Cubiche\Domain\EventSourcing\Metadata\ClassMetadata;
15
16
/**
17
 * AnnotationDriver class.
18
 *
19
 * @author Ivannis Suárez Jerez <[email protected]>
20
 */
21
class AnnotationDriver extends AbstractAnnotationDriver
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function loadMetadataForClass(\ReflectionClass $class)
27
    {
28
        $classMetadata = new ClassMetadata($class->getName());
0 ignored issues
show
Bug introduced by
Consider using $class->name. There is an issue with getName() and APC-enabled PHP versions.
Loading history...
29
30
        $classAnnotations = $this->reader->getClassAnnotations($class);
31
        foreach ($classAnnotations as $annotation) {
32
            if ($annotation instanceof Migratable) {
33
                $classMetadata->setIsMigratable(true);
34
            }
35
        }
36
37
        return $classMetadata;
38
    }
39
}
40