AbstractNamingStrategy::doConvert()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
ccs 0
cts 0
cp 0
c 0
b 0
f 0
nc 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 268
    public function convert($name)
28
    {
29 268
        return isset($this->names[$name])
30 164
            ? $this->names[$name]
31 268
            : $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