PimpleFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
cbo 1
dl 0
loc 30
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A createStateMachine() 0 4 1
1
<?php
2
3
namespace Finite\Factory;
4
5
use Pimple;
6
7
/**
8
 * A concrete implementation of State Machine Factory using Pimple.
9
 *
10
 * @author Yohan Giarelli <[email protected]>
11
 */
12
class PimpleFactory extends AbstractFactory
13
{
14
    /**
15
     * @var Pimple
16
     */
17
    protected $container;
18
19
    /**
20
     * @var string
21
     */
22
    protected $id;
23
24
    /**
25
     * @param Pimple $container
26
     * @param string $id
27
     */
28 70
    public function __construct(Pimple $container, $id)
29
    {
30 70
        $this->container = $container;
31 70
        $this->id = $id;
32 70
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37 65
    protected function createStateMachine()
38
    {
39 65
        return $this->container[$this->id];
40
    }
41
}
42