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

TemplateFactory::create()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 16
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 4.0741

Importance

Changes 2
Bugs 0 Features 2
Metric Value
c 2
b 0
f 2
dl 0
loc 16
ccs 10
cts 12
cp 0.8333
rs 9.2
cc 4
eloc 12
nc 4
nop 1
crap 4.0741
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