LaravelTransitionFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 28
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A create() 0 8 2
1
<?php
2
3
namespace Transitions;
4
5
use Illuminate\Contracts\Container\Container;
6
7
class LaravelTransitionFactory implements TransitionFactory
8
{
9
10
    /**
11
     * @var array
12
     */
13
    private static $transitions = [];
14
15
    /**
16
     * @var Container
17
     */
18
    private $container;
19
20 9
    public function __construct(Container $container)
21
    {
22
23 9
        $this->container = $container;
24 9
    }
25
26 9
    public function create(string $transition) : Transition
27
    {
28
29 9
        if (! isset(self::$transitions[$transition])) {
30 6
            self::$transitions[$transition] = $this->container->make($transition);
31
        }
32 9
        return self::$transitions[$transition];
33
    }
34
}
35