AbstractTypeGuesser   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getParentMetadataForProperty() 0 9 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\DoctrineMongoDBAdminBundle\Guesser;
15
16
use Doctrine\ODM\MongoDB\Mapping\MappingException;
17
use Sonata\AdminBundle\Guesser\TypeGuesserInterface;
18
use Sonata\DoctrineMongoDBAdminBundle\Model\ModelManager;
19
20
abstract class AbstractTypeGuesser implements TypeGuesserInterface
21
{
22
    /**
23
     * @param string $baseClass
24
     * @param string $propertyFullName
25
     *
26
     * @return array|null
27
     */
28
    protected function getParentMetadataForProperty($baseClass, $propertyFullName, ModelManager $modelManager)
29
    {
30
        try {
31
            return $modelManager->getParentMetadataForProperty($baseClass, $propertyFullName);
32
        } catch (MappingException $e) {
33
            // no metadata found.
34
            return null;
35
        }
36
    }
37
}
38