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

uiLabel::__construct()   B

Complexity

Conditions 4
Paths 4

Size

Total Lines 29
Code Lines 25

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 21
CRAP Score 4.1137

Importance

Changes 0
Metric Value
dl 0
loc 29
ccs 21
cts 26
cp 0.8077
rs 8.5806
c 0
b 0
f 0
cc 4
eloc 25
nc 4
nop 3
crap 4.1137
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