CaseTransformer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A transform() 0 6 1
1
<?php
2
3
/*
4
 * This file is part of Camel.
5
 *
6
 * (c) Matthieu Moquet <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Camel;
13
14
use Camel\Format\FormatInterface;
15
16
/**
17
 * Global transformer used to manage format conversion.
18
 *
19
 * @author Matthieu Moquet <[email protected]>
20
 */
21
class CaseTransformer implements CaseTransformerInterface
22
{
23
    /**
24
     * @var FormatInterface Initial case format
25
     */
26
    protected $from;
27
28
    /**
29
     * @var FormatInterface Final case format
30
     */
31
    protected $to;
32
33
    /**
34
     * @param FormatInterface $from
35
     * @param FormatInterface $to
36
     */
37
    public function __construct(FormatInterface $from, FormatInterface $to)
38
    {
39
        $this->from = $from;
40
        $this->to = $to;
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function transform($word)
47
    {
48
        $words = $this->from->split($word);
49
50
        return $this->to->join($words);
51
    }
52
}