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

TemplateFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 0
cbo 2
dl 0
loc 23
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 13 3
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