PimpleFactory::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 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