Passed
Push — master ( 689ec5...45f08c )
by Sebastian
05:26
created

FontWeight   A

Complexity

Total Complexity 15

Size/Duplication

Total Lines 156
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 15
eloc 25
c 1
b 0
f 0
dl 0
loc 156
rs 10

15 Methods

Rating   Name   Duplication   Size   Complexity  
A medium() 0 3 1
A black() 0 3 1
A namedNormal() 0 3 1
A getName() 0 3 1
A normal() 0 3 1
A extraBold() 0 3 1
A namedBold() 0 3 1
A thin() 0 3 1
A relativeBolder() 0 3 1
A bold() 0 3 1
A customNumber() 0 3 1
A semiBold() 0 3 1
A relativeLighter() 0 3 1
A extraLight() 0 3 1
A light() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AppUtils\StyleCollection\StyleBuilder\Flavors\Font;
6
7
use AppUtils\StyleCollection\StyleBuilder;
8
use AppUtils\StyleCollection\StyleBuilder\StyleContainer;
9
10
class FontWeight extends StyleContainer
11
{
12
    public const WEIGHT_THIN = 100;
13
    public const WEIGHT_EXTRA_LIGHT = 200;
14
    public const WEIGHT_LIGHT = 300;
15
    public const WEIGHT_NORMAL = 400;
16
    public const WEIGHT_MEDIUM = 500;
17
    public const WEIGHT_SEMI_BOLD = 600;
18
    public const WEIGHT_BOLD = 700;
19
    public const WEIGHT_EXTRA_BOLD = 800;
20
    public const WEIGHT_BLACK = 900;
21
22
    protected function getName() : string
23
    {
24
        return 'font-weight';
25
    }
26
27
    // region: Numeric values
28
29
    public function customNumber(int $weight, bool $important = false) : StyleBuilder
30
    {
31
        return $this->setStyle((string)$weight, $important);
32
    }
33
34
    /**
35
     * Hairline-thin - 100
36
     * @param bool $important
37
     * @return StyleBuilder
38
     */
39
    public function thin(bool $important=false) : StyleBuilder
40
    {
41
        return $this->customNumber(self::WEIGHT_THIN, $important);
42
    }
43
44
    /**
45
     * Extra-light (ultra light) - 200
46
     * @param bool $important
47
     * @return StyleBuilder
48
     */
49
    public function extraLight(bool $important=false) : StyleBuilder
50
    {
51
        return $this->customNumber(self::WEIGHT_EXTRA_LIGHT, $important);
52
    }
53
54
    /**
55
     * Light - 300
56
     * @param bool $important
57
     * @return StyleBuilder
58
     */
59
    public function light(bool $important=false) : StyleBuilder
60
    {
61
        return $this->customNumber(self::WEIGHT_LIGHT, $important);
62
    }
63
64
    /**
65
     * Normal - 400
66
     * @param bool $important
67
     * @return StyleBuilder
68
     */
69
    public function normal(bool $important=false) : StyleBuilder
70
    {
71
        return $this->customNumber(self::WEIGHT_NORMAL, $important);
72
    }
73
74
    /**
75
     * Medium - 500
76
     * @param bool $important
77
     * @return StyleBuilder
78
     */
79
    public function medium(bool $important=false) : StyleBuilder
80
    {
81
        return $this->customNumber(self::WEIGHT_MEDIUM, $important);
82
    }
83
84
    /**
85
     * Semi-bold (Demi bold) - 600
86
     * @param bool $important
87
     * @return StyleBuilder
88
     */
89
    public function semiBold(bool $important=false) : StyleBuilder
90
    {
91
        return $this->customNumber(self::WEIGHT_SEMI_BOLD, $important);
92
    }
93
94
    /**
95
     * Bold - 700
96
     * @param bool $important
97
     * @return StyleBuilder
98
     */
99
    public function bold(bool $important=false) : StyleBuilder
100
    {
101
        return $this->customNumber(self::WEIGHT_BOLD, $important);
102
    }
103
104
    /**
105
     * Extra bold (Ultra bold) - 800
106
     * @param bool $important
107
     * @return StyleBuilder
108
     */
109
    public function extraBold(bool $important=false) : StyleBuilder
110
    {
111
        return $this->customNumber(self::WEIGHT_EXTRA_BOLD, $important);
112
    }
113
114
    /**
115
     * Black (Heavy) - 900
116
     * @param bool $important
117
     * @return StyleBuilder
118
     */
119
    public function black(bool $important=false) : StyleBuilder
120
    {
121
        return $this->customNumber(self::WEIGHT_BLACK, $important);
122
    }
123
124
    // endregion
125
126
    // region: Keyword values
127
128
    /**
129
     * Bold using the `bold` keyword instead of a numeric weight (i.e. `font-weight:bold`).
130
     * @param bool $important
131
     * @return StyleBuilder
132
     */
133
    public function namedBold(bool $important=false) : StyleBuilder
134
    {
135
        return $this->setStyle('bold', $important);
136
    }
137
138
    /**
139
     * Bold using the `normal` keyword instead of a numeric weight (i.e. `font-weight:normal`).
140
     * @param bool $important
141
     * @return StyleBuilder
142
     */
143
    public function namedNormal(bool $important=false) : StyleBuilder
144
    {
145
        return $this->setStyle('normal', $important);
146
    }
147
148
    /**
149
     * Weight relative to the parent element using the `lighter` keyword.
150
     * @param bool $important
151
     * @return StyleBuilder
152
     */
153
    public function relativeLighter(bool $important=false) : StyleBuilder
154
    {
155
        return $this->setStyle('lighter', $important);
156
    }
157
158
    /**
159
     * Weight relative to the parent element using the `bolder` keyword.
160
     * @param bool $important
161
     * @return StyleBuilder
162
     */
163
    public function relativeBolder(bool $important=false) : StyleBuilder
164
    {
165
        return $this->setStyle('bolder', $important);
166
    }
167
168
    // endregion
169
}
170