Completed
Push — master ( 4f22f1...5f0959 )
by Yuri
03:56
created

TemplateFactory::create()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 13
rs 9.4286
cc 3
eloc 9
nc 3
nop 1
1
<?php
2
3
namespace Tamtamchik\SimpleFlash;
4
5
use Tamtamchik\SimpleFlash\Templates\Bootstrap3Template;
6
use Tamtamchik\SimpleFlash\Templates\Foundation5Template;
7
8
/**
9
 * Class TemplateFactory
10
 */
11
class TemplateFactory
12
{
13
    /**
14
     * Return template from available list of templates.
15
     *
16
     * @param string $name - available templates: bootstrap3, foundation5
17
     *
18
     * @return TemplateInterface
19
     */
20
    public static function create($name = 'bootstrap3')
21
    {
22
        switch ($name) {
23
            case 'foundation5':
24
                $result = new Foundation5Template();
25
                break;
26
            case 'bootstrap3':
27
            default:
28
                $result = new Bootstrap3Template();
29
        }
30
31
        return $result;
32
    }
33
}
34