Completed
Push — master ( 6614c5...d91aa4 )
by Yuri
02:23
created

TemplateFactory::create()   B

Complexity

Conditions 5
Paths 5

Size

Total Lines 19
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 15
CRAP Score 5

Importance

Changes 3
Bugs 0 Features 3
Metric Value
c 3
b 0
f 3
dl 0
loc 19
ccs 15
cts 15
cp 1
rs 8.8571
cc 5
eloc 15
nc 5
nop 1
crap 5
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
use Tamtamchik\SimpleFlash\Templates\Semantic2Template;
9
10
/**
11
 * Class TemplateFactory.
12
 */
13
class TemplateFactory
14
{
15
    /**
16
     * Return template from available list of templates.
17
     *
18
     * @param string $name - available templates: bootstrap3, foundation5
19
     *
20
     * @return TemplateInterface
21
     */
22 102
    public static function create($name = 'bootstrap3')
23
    {
24
        switch ($name) {
25 102
            case 'semantic2':
26 6
                $result = new Semantic2Template();
27 6
                break;
28 99
            case 'foundation6':
29 6
                $result = new Foundation6Template();
30 6
                break;
31 96
            case 'foundation5':
32 15
                $result = new Foundation5Template();
33 15
                break;
34 90
            case 'bootstrap3':
35 90
            default:
36 90
                $result = new Bootstrap3Template();
37 90
        }
38
39 102
        return $result;
40
    }
41
}
42