ExcelBuilderFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 32
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A create() 0 10 2
1
<?php
2
3
namespace Pim\Bundle\ExcelConnectorBundle\Excel\Builder;
4
5
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
6
use Symfony\Component\DependencyInjection\ContainerInterface;
7
8
/**
9
 * Factory for Excel builders
10
 *
11
 * @author    Antoine Guigan <[email protected]>
12
 * @copyright 2013 Akeneo SAS (http://www.akeneo.com)
13
 * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
14
 */
15
class ExcelBuilderFactory
16
{
17
    /** @var ContainerInterface */
18
    protected $container;
19
20
    /**
21
     * @param ContainerInterface $container
22
     */
23
    public function __construct(ContainerInterface $container)
24
    {
25
        $this->container = $container;
26
    }
27
28
    /**
29
     * Creates an $builder for the given arguments
30
     *
31
     * @param string $class   The class of the $builder
32
     * @param array  $options The options of the $builder
33
     *
34
     * @return ExcelBuilderInterface
35
     */
36
    public function create($class, array $options = array())
37
    {
38
        $builder = new $class($options);
39
40
        if ($builder instanceof ContainerAwareInterface) {
41
            $builder->setContainer($this->container);
42
        }
43
44
        return $builder;
45
    }
46
}
47