ValueTransformerFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A create() 0 4 1
1
<?php
2
3
namespace Akeneo\Component\SpreadsheetParser\Xlsx;
4
5
/**
6
 * Creates ValueTransformer objects
7
 *
8
 * @author    Antoine Guigan <[email protected]>
9
 * @copyright 2014 Akeneo SAS (http://www.akeneo.com)
10
 * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
11
 */
12
class ValueTransformerFactory
13
{
14
    /**
15
     *
16
     * @var string
17
     */
18
    protected $transformerClass;
19
20
    /**
21
     *
22
     * @var DateTransformer
23
     */
24
    protected $dateTransformer;
25
26
    /**
27
     * Constructor
28
     *
29
     * @param DateTransformer $dateTransformer
30
     * @param string          $transformerClass The class of the created objects
31
     */
32
    public function __construct(DateTransformer $dateTransformer, $transformerClass)
33
    {
34
        $this->dateTransformer = $dateTransformer;
35
        $this->transformerClass = $transformerClass;
36
    }
37
38
    /**
39
     * Creates a value transformer
40
     *
41
     * @param SharedStrings $sharedStrings
42
     * @param Styles        $styles
43
     * 
44
     * @return ValueTransformer
45
     */
46
    public function create(SharedStrings $sharedStrings, Styles $styles)
47
    {
48
        return new $this->transformerClass($this->dateTransformer, $sharedStrings, $styles);
49
    }
50
}
51