Completed
Push — dev ( 845ef5...8eacd8 )
by
unknown
02:50
created

LabelFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 25
ccs 11
cts 11
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 19 3
1
<?php
2
3
namespace eXpansion\Framework\Core\Model\Gui\Factory;
4
use FML\Controls\Label;
5
6
/**
7
 * Class LineBuilder
8
 *
9
 * @package eXpansion\Framework\Core\Model\Gui\Builders;
10
 * @author  oliver de Cramer <[email protected]>
11
 */
12
class LabelFactory
13
{
14
    const TYPE_NORMAL = "normal";
15
    const TYPE_TITLE = 'title';
16
17 8
    public function create($text, $translate = false, $type = self::TYPE_NORMAL)
18
    {
19 8
        $label = new Label();
20 8
        $label->setTextSize(2)
21 8
            ->setHeight(4)
22 8
            ->setTranslate($translate);
23
24 8
        if ($translate) {
25 6
            $label->setTextId($text);
26
        } else {
27 8
            $label->setText($text);
28
        }
29
30 8
        if ($type == self::TYPE_TITLE) {
31 6
            $label->setTextFont('RajdhaniMono');
32
        }
33
34 8
        return $label;
35
    }
36
}
37