Completed
Pull Request — master (#99)
by De Cramer
02:46
created

uiLabel   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 82.14%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 0
loc 59
ccs 23
cts 28
cp 0.8214
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 29 4
A render() 0 11 1
1
<?php
2
3
namespace eXpansion\Framework\Gui\Components;
4
5
use FML\Controls\Label;
6
7
class uiLabel extends Label
8
{
9
10
    const TYPE_NORMAL = "normal";
11
    const TYPE_TITLE = "title";
12
    const TYPE_HEADER = "header";
13
14
    /**
15
     * uiLabel constructor.
16
     * @param string $text
17
     * @param string $type
18
     * @param string|null $controlId
19
     */
20 1
    public function __construct($text = "", $type = self::TYPE_NORMAL, $controlId = null)
21
    {
22 1
        parent::__construct($controlId);
23 1
        $this->setText($text)
24 1
            ->setAreaColor("0000")
25 1
            ->setAreaFocusColor('0000')
26 1
            ->setScriptEvents(true);
27
28
        switch ($type) {
29 1
            case self::TYPE_NORMAL:
30 1
                $this->setTextSize(2)
31 1
                    ->setHeight(5);
32 1
                break;
33 1
            case self::TYPE_TITLE:
34 1
                $this->setTextSize(3)
35 1
                    ->setHeight(5)
36 1
                    ->setTextFont('file://Media/Font/BiryaniDemiBold.Font.gbx');
37 1
                break;
38 1
            case self::TYPE_HEADER:
39 1
                $this->setTextSize(3)
40 1
                    ->setHeight(5)
41 1
                    ->setTextFont('file://Media/Font/BiryaniDemiBold.Font.gbx');
42 1
                break;
43
            default:
44
                $this->setTextSize(2)
45
                    ->setHeight(5);
46
                break;
47
        }
48 1
    }
49
50
    /**
51
     * @param DOMDocument $domDocument
52
     * @return DOMElement
53
     */
54 1
    public function render(\DOMDocument $domDocument)
55
    {
56
        /*  $text = "";
0 ignored issues
show
Unused Code Comprehensibility introduced by
60% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
57
          if ($this->getTranslate() === true) {
58
              $text = $this->getText();
59
              $this->setTextId($text);
60
              $this->setText(null);
61
          } */
62
63 1
        return parent::render($domDocument);
64
    }
65
}
66