AbstractClassMetadataFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 24
c 0
b 0
f 0
wmc 2
lcom 1
cbo 0
ccs 4
cts 4
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getClassMetadata() 0 6 2
fetchClassMetadata() 0 1 ?
1
<?php
2
3
/*
4
 * This file is part of the Ivory Serializer package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ivory\Serializer\Mapping\Factory;
13
14
use Ivory\Serializer\Mapping\ClassMetadataInterface;
15
16
/**
17
 * @author GeLo <[email protected]>
18
 */
19
abstract class AbstractClassMetadataFactory implements ClassMetadataFactoryInterface
20
{
21
    /**
22
     * @var ClassMetadataInterface[]
23
     */
24
    private $classMetadatas = [];
25
26
    /**
27
     * {@inheritdoc}
28
     */
29 1112
    public function getClassMetadata($class)
30
    {
31 1112
        return array_key_exists($class, $this->classMetadatas)
32 140
            ? $this->classMetadatas[$class]
33 1112
            : $this->classMetadatas[$class] = $this->fetchClassMetadata($class);
34
    }
35
36
    /**
37
     * @param string $class
38
     *
39
     * @return ClassMetadataInterface|null
40
     */
41
    abstract protected function fetchClassMetadata($class);
42
}
43