Completed
Push — master ( b6962a...dbec43 )
by Eric
03:55
created

AbstractNamingStrategy   A

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
wmc 2
lcom 1
cbo 0
dl 0
loc 24
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A convert() 0 6 2
doConvert() 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\Naming;
13
14
/**
15
 * @author GeLo <[email protected]>
16
 */
17
abstract class AbstractNamingStrategy implements NamingStrategyInterface
18
{
19
    /**
20
     * @var string[]
21
     */
22
    private $names = [];
23
24
    /**
25
     * {@inheritdoc}
26
     */
27 180
    public function convert($name)
28
    {
29 180
        return isset($this->names[$name])
30 130
            ? $this->names[$name]
31 180
            : $this->names[$name] = $this->doConvert($name);
32
    }
33
34
    /**
35
     * @param string $name
36
     *
37
     * @return string
38
     */
39
    abstract protected function doConvert($name);
40
}
41