ThemeFactory   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1
Metric Value
wmc 10
lcom 0
cbo 1
dl 0
loc 42
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
F create() 0 34 10
1
<?php
2
3
namespace Oro\Component\Layout\Extension\Theme\Model;
4
5
class ThemeFactory implements ThemeFactoryInterface
6
{
7
    /**
8
     * {@inheritdoc}
9
     *
10
     * @SuppressWarnings(PHPMD.NPathComplexity)
11
     */
12
    public function create($themeName, array $themeDefinition)
13
    {
14
        $theme = new Theme(
15
            $themeName,
16
            isset($themeDefinition['parent']) ? $themeDefinition['parent'] : null
17
        );
18
19
        if (isset($themeDefinition['label'])) {
20
            $theme->setLabel($themeDefinition['label']);
21
        }
22
        if (isset($themeDefinition['screenshot'])) {
23
            $theme->setScreenshot($themeDefinition['screenshot']);
24
        }
25
        if (isset($themeDefinition['icon'])) {
26
            $theme->setIcon($themeDefinition['icon']);
27
        }
28
        if (isset($themeDefinition['logo'])) {
29
            $theme->setLogo($themeDefinition['logo']);
30
        }
31
        if (isset($themeDefinition['directory'])) {
32
            $theme->setDirectory($themeDefinition['directory']);
33
        }
34
        if (isset($themeDefinition['groups'])) {
35
            $theme->setGroups((array)$themeDefinition['groups']);
36
        }
37
        if (isset($themeDefinition['description'])) {
38
            $theme->setDescription($themeDefinition['description']);
39
        }
40
        if (isset($themeDefinition['data'])) {
41
            $theme->setData($themeDefinition['data']);
42
        }
43
44
        return $theme;
45
    }
46
}
47