DoctrineAdapterLocator   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A findMappingFile() 0 10 2
A getAllClassNames() 0 4 1
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
11
namespace Cubiche\Infrastructure\Doctrine\ODM\MongoDB\Metadata\Locator;
12
13
use Cubiche\Core\Metadata\Locator\FileLocatorInterface;
14
use Doctrine\Common\Persistence\Mapping\MappingException;
15
use Doctrine\Common\Persistence\Mapping\Driver\FileLocator;
16
17
/**
18
 * DoctrineAdapterLocator class.
19
 *
20
 * @author Ivannis Suárez Jerez <[email protected]>
21
 */
22
class DoctrineAdapterLocator implements FileLocatorInterface
23
{
24
    /**
25
     * @var FileLocator
26
     */
27
    protected $locator;
28
29
    /**
30
     * DoctrineAdapterLocator constructor.
31
     *
32
     * @param FileLocator $locator
33
     */
34
    public function __construct(FileLocator $locator)
35
    {
36
        $this->locator = $locator;
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function findMappingFile($className, $extension)
43
    {
44
        $this->locator->setFileExtension($extension);
45
46
        try {
47
            return $this->locator->findMappingFile($className);
48
        } catch (MappingException $e) {
49
            return;
50
        }
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56
    public function getAllClassNames($extension)
57
    {
58
        return $this->locator->getAllClassNames(null);
59
    }
60
}
61