Completed
Push — master ( 3b9aa3...c94215 )
by Yuri
06:31
created

TemplateFactory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 83.33%

Importance

Changes 2
Bugs 0 Features 2
Metric Value
wmc 4
c 2
b 0
f 2
lcom 0
cbo 3
dl 0
loc 26
ccs 10
cts 12
cp 0.8333
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 16 4
1
<?php
2
3
namespace Tamtamchik\SimpleFlash;
4
5
use Tamtamchik\SimpleFlash\Templates\Bootstrap3Template;
6
use Tamtamchik\SimpleFlash\Templates\Foundation5Template;
7
use Tamtamchik\SimpleFlash\Templates\Foundation6Template;
8
9
/**
10
 * Class TemplateFactory.
11
 */
12
class TemplateFactory
13
{
14
    /**
15
     * Return template from available list of templates.
16
     *
17
     * @param string $name - available templates: bootstrap3, foundation5
18
     *
19
     * @return TemplateInterface
20
     */
21 93
    public static function create($name = 'bootstrap3')
22
    {
23
        switch ($name) {
24 93
            case 'foundation6':
25
                $result = new Foundation6Template();
26
                break;
27 93
            case 'foundation5':
28 12
                $result = new Foundation5Template();
29 12
                break;
30 87
            case 'bootstrap3':
31 87
            default:
32 87
                $result = new Bootstrap3Template();
33 87
        }
34
35 93
        return $result;
36
    }
37
}
38