Completed
Push — master ( 39c546...d78055 )
by Tobias
32:44 queued 31:26
created

FakeSerializerLoader::loadClassMetadata()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Happyr\AnnotationWarmer\Loader;
6
7
use Happyr\AnnotationWarmer\Service\AnnotationManager;
8
use Symfony\Component\Serializer\Mapping\ClassMetadataInterface;
9
use Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader;
10
11
/**
12
 * Pretend that we will load from Yaml, but serve content from annotation cache instead.
13
 *
14
 * @author Tobias Nyholm <[email protected]>
15
 */
16
final class FakeSerializerLoader extends YamlFileLoader
17
{
18
    private $manager;
19
20
    public function __construct(AnnotationManager $manager)
21
    {
22
        $this->manager = $manager;
23
    }
24
25
    public function loadClassMetadata(ClassMetadataInterface $classMetadata)
26
    {
27
        // We dont need to do anything. The AnnotationLoader will handle things
28
    }
29
30
    public function getMappedClasses()
31
    {
32
        return $this->manager->getAllClasses();
33
    }
34
}
35