@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * @param array<string,string|number|NumberInfo|Interface_Stringable|NULL> $styles |
35 | 35 | */ |
36 | - public function __construct(array $styles=array()) |
|
36 | + public function __construct(array $styles = array()) |
|
37 | 37 | { |
38 | 38 | $this->options = new StyleOptions(); |
39 | 39 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param array<string,string|number|NumberInfo|Interface_Stringable|NULL> $styles |
45 | 45 | * @return StyleCollection |
46 | 46 | */ |
47 | - public static function create(array $styles=array()) : StyleCollection |
|
47 | + public static function create(array $styles = array()) : StyleCollection |
|
48 | 48 | { |
49 | 49 | return new StyleCollection($styles); |
50 | 50 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | { |
69 | 69 | $lines = explode(';', $string); |
70 | 70 | |
71 | - foreach($lines as $line) |
|
71 | + foreach ($lines as $line) |
|
72 | 72 | { |
73 | 73 | $parts = explode(':', $line); |
74 | 74 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function setStyles(array $styles) : StyleCollection |
91 | 91 | { |
92 | - foreach($styles as $name => $value) |
|
92 | + foreach ($styles as $name => $value) |
|
93 | 93 | { |
94 | 94 | $this->styleAuto($name, $value); |
95 | 95 | } |
@@ -105,14 +105,14 @@ discard block |
||
105 | 105 | * @param bool $important |
106 | 106 | * @return $this |
107 | 107 | */ |
108 | - public function style(string $name, string $value, bool $important=false) : StyleCollection |
|
108 | + public function style(string $name, string $value, bool $important = false) : StyleCollection |
|
109 | 109 | { |
110 | - if($value === '') |
|
110 | + if ($value === '') |
|
111 | 111 | { |
112 | 112 | return $this; |
113 | 113 | } |
114 | 114 | |
115 | - if($important && stripos($value, '!important') === false) |
|
115 | + if ($important && stripos($value, '!important') === false) |
|
116 | 116 | { |
117 | 117 | $value .= ' !important'; |
118 | 118 | } |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | * @param bool $important |
131 | 131 | * @return $this |
132 | 132 | */ |
133 | - public function styleAuto(string $name, $value, bool $important=false) : StyleCollection |
|
133 | + public function styleAuto(string $name, $value, bool $important = false) : StyleCollection |
|
134 | 134 | { |
135 | - if($value instanceof NumberInfo) |
|
135 | + if ($value instanceof NumberInfo) |
|
136 | 136 | { |
137 | 137 | return $this->style($name, $value->toCSS(), $important); |
138 | 138 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | return $this->style($name, (string)$value, $important); |
141 | 141 | } |
142 | 142 | |
143 | - public function stylePX(string $name, int $px, bool $important=false) : StyleCollection |
|
143 | + public function stylePX(string $name, int $px, bool $important = false) : StyleCollection |
|
144 | 144 | { |
145 | 145 | return $this->style($name, $px.'px', $important); |
146 | 146 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * @param bool $important |
170 | 170 | * @return $this |
171 | 171 | */ |
172 | - public function styleParseNumber(string $name, $value, bool $important=false) : StyleCollection |
|
172 | + public function styleParseNumber(string $name, $value, bool $important = false) : StyleCollection |
|
173 | 173 | { |
174 | 174 | return $this->styleNumber($name, parseNumber($value), $important); |
175 | 175 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * @param bool $important |
183 | 183 | * @return $this |
184 | 184 | */ |
185 | - public function styleNumber(string $name, NumberInfo $info, bool $important=false) : StyleCollection |
|
185 | + public function styleNumber(string $name, NumberInfo $info, bool $important = false) : StyleCollection |
|
186 | 186 | { |
187 | 187 | $this->style($name, $info->toCSS(), $important); |
188 | 188 | return $this; |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | |
191 | 191 | public function remove(string $name) : StyleCollection |
192 | 192 | { |
193 | - if(isset($this->styles[$name])) |
|
193 | + if (isset($this->styles[$name])) |
|
194 | 194 | { |
195 | 195 | unset($this->styles[$name]); |
196 | 196 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | { |
227 | 227 | $all = self::create(); |
228 | 228 | |
229 | - foreach($collections as $collection) |
|
229 | + foreach ($collections as $collection) |
|
230 | 230 | { |
231 | 231 | $all->mergeWith($collection); |
232 | 232 | } |
@@ -339,7 +339,7 @@ |
||
339 | 339 | */ |
340 | 340 | private function requireValidComponent(string $name) : void |
341 | 341 | { |
342 | - if(in_array($name, self::COLOR_COMPONENTS)) |
|
342 | + if (in_array($name, self::COLOR_COMPONENTS)) |
|
343 | 343 | { |
344 | 344 | return; |
345 | 345 | } |
@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | |
25 | 25 | $attributes = $this->compileAttributes(); |
26 | 26 | |
27 | - if(empty($attributes)) |
|
27 | + if (empty($attributes)) |
|
28 | 28 | { |
29 | 29 | return ''; |
30 | 30 | } |
31 | 31 | |
32 | - foreach($attributes as $name => $value) |
|
32 | + foreach ($attributes as $name => $value) |
|
33 | 33 | { |
34 | - if($value === '') |
|
34 | + if ($value === '') |
|
35 | 35 | { |
36 | 36 | continue; |
37 | 37 | } |
@@ -53,12 +53,12 @@ discard block |
||
53 | 53 | { |
54 | 54 | $attributes = $this->collection->getRawAttributes(); |
55 | 55 | |
56 | - if($this->collection->hasClasses()) |
|
56 | + if ($this->collection->hasClasses()) |
|
57 | 57 | { |
58 | 58 | $attributes['class'] = $this->collection->classesToString(); |
59 | 59 | } |
60 | 60 | |
61 | - if($this->collection->hasStyles()) |
|
61 | + if ($this->collection->hasStyles()) |
|
62 | 62 | { |
63 | 63 | $attributes['style'] = $this->collection->getStyles() |
64 | 64 | ->configureForInline() |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | private function renderAttribute(string $name, string $value) : string |
72 | 72 | { |
73 | - if($name === $value) |
|
73 | + if ($name === $value) |
|
74 | 74 | { |
75 | 75 | return $name; |
76 | 76 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | public function render() : string |
28 | 28 | { |
29 | - if($this->collection->hasStyles()) |
|
29 | + if ($this->collection->hasStyles()) |
|
30 | 30 | { |
31 | 31 | return implode( |
32 | 32 | $this->resolveSeparator(), |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | private function resolveSuffix() : string |
41 | 41 | { |
42 | - if($this->options->isTrailingSemicolonEnabled()) |
|
42 | + if ($this->options->isTrailingSemicolonEnabled()) |
|
43 | 43 | { |
44 | 44 | return ';'; |
45 | 45 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | private function resolveSeparator() : string |
51 | 51 | { |
52 | - if($this->options->isNewlineEnabled()) |
|
52 | + if ($this->options->isNewlineEnabled()) |
|
53 | 53 | { |
54 | 54 | return ';'.PHP_EOL; |
55 | 55 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | { |
62 | 62 | $indentLevel = $this->options->getIndentLevel(); |
63 | 63 | |
64 | - if($indentLevel > 0) |
|
64 | + if ($indentLevel > 0) |
|
65 | 65 | { |
66 | 66 | return str_repeat($this->options->getIndentChar(), $indentLevel); |
67 | 67 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | private function resolveValueSpace() : string |
73 | 73 | { |
74 | - if($this->options->isSpaceBeforeValueEnabled()) |
|
74 | + if ($this->options->isSpaceBeforeValueEnabled()) |
|
75 | 75 | { |
76 | 76 | return ' '; |
77 | 77 | } |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | $indent = $this->resolveIndent(); |
87 | 87 | $valueSpace = $this->resolveValueSpace(); |
88 | 88 | |
89 | - if($this->options->isSortingEnabled()) |
|
89 | + if ($this->options->isSortingEnabled()) |
|
90 | 90 | { |
91 | 91 | ksort($styles); |
92 | 92 | } |
93 | 93 | |
94 | - foreach($styles as $name => $value) |
|
94 | + foreach ($styles as $name => $value) |
|
95 | 95 | { |
96 | 96 | $lines[] = sprintf( |
97 | 97 | '%s%s:%s%s', |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | ); |
32 | 32 | } |
33 | 33 | |
34 | - public function enableSorting(bool $enabled=true) : StyleOptions |
|
34 | + public function enableSorting(bool $enabled = true) : StyleOptions |
|
35 | 35 | { |
36 | 36 | return $this->setOption(self::OPTION_SORTING, $enabled); |
37 | 37 | } |
38 | 38 | |
39 | - public function enableSpaceBeforeValue(bool $enabled=true) : StyleOptions |
|
39 | + public function enableSpaceBeforeValue(bool $enabled = true) : StyleOptions |
|
40 | 40 | { |
41 | 41 | return $this->setOption(self::OPTION_SPACE_BEFORE_VALUE, $enabled); |
42 | 42 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param bool $enabled |
46 | 46 | * @return $this |
47 | 47 | */ |
48 | - public function enableNewline(bool $enabled=true) : StyleOptions |
|
48 | + public function enableNewline(bool $enabled = true) : StyleOptions |
|
49 | 49 | { |
50 | 50 | return $this->setOption(self::OPTION_NEWLINES, $enabled); |
51 | 51 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | return $this->getStringOption(self::OPTION_INDENT_CHAR); |
119 | 119 | } |
120 | 120 | |
121 | - public function enableTrailingSemicolon(bool $enabled=true) : StyleOptions |
|
121 | + public function enableTrailingSemicolon(bool $enabled = true) : StyleOptions |
|
122 | 122 | { |
123 | 123 | return $this->setOption(self::OPTION_TRAILING_SEMICOLON, $enabled); |
124 | 124 | } |
@@ -24,27 +24,27 @@ |
||
24 | 24 | * @param bool $important |
25 | 25 | * @return StyleBuilder |
26 | 26 | */ |
27 | - public function custom(string $value, bool $important=false) : StyleBuilder |
|
27 | + public function custom(string $value, bool $important = false) : StyleBuilder |
|
28 | 28 | { |
29 | 29 | return $this->setStyle($value, $important); |
30 | 30 | } |
31 | 31 | |
32 | - public function block(bool $important=false) : StyleBuilder |
|
32 | + public function block(bool $important = false) : StyleBuilder |
|
33 | 33 | { |
34 | 34 | return $this->setStyle('block', $important); |
35 | 35 | } |
36 | 36 | |
37 | - public function none(bool $important=false) : StyleBuilder |
|
37 | + public function none(bool $important = false) : StyleBuilder |
|
38 | 38 | { |
39 | 39 | return $this->setStyle('none', $important); |
40 | 40 | } |
41 | 41 | |
42 | - public function inline(bool $important=false) : StyleBuilder |
|
42 | + public function inline(bool $important = false) : StyleBuilder |
|
43 | 43 | { |
44 | 44 | return $this->setStyle('inline', $important); |
45 | 45 | } |
46 | 46 | |
47 | - public function inlineBlock(bool $important=false) : StyleBuilder |
|
47 | + public function inlineBlock(bool $important = false) : StyleBuilder |
|
48 | 48 | { |
49 | 49 | return $this->setStyle('inline-block', $important); |
50 | 50 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | return 'width'; |
15 | 15 | } |
16 | 16 | |
17 | - public function auto(bool $important=false) : StyleBuilder |
|
17 | + public function auto(bool $important = false) : StyleBuilder |
|
18 | 18 | { |
19 | 19 | return $this->setStyle('auto', $important); |
20 | 20 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @param bool $important |
37 | 37 | * @return StyleBuilder |
38 | 38 | */ |
39 | - public function thin(bool $important=false) : StyleBuilder |
|
39 | + public function thin(bool $important = false) : StyleBuilder |
|
40 | 40 | { |
41 | 41 | return $this->customNumber(self::WEIGHT_THIN, $important); |
42 | 42 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @param bool $important |
47 | 47 | * @return StyleBuilder |
48 | 48 | */ |
49 | - public function extraLight(bool $important=false) : StyleBuilder |
|
49 | + public function extraLight(bool $important = false) : StyleBuilder |
|
50 | 50 | { |
51 | 51 | return $this->customNumber(self::WEIGHT_EXTRA_LIGHT, $important); |
52 | 52 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @param bool $important |
57 | 57 | * @return StyleBuilder |
58 | 58 | */ |
59 | - public function light(bool $important=false) : StyleBuilder |
|
59 | + public function light(bool $important = false) : StyleBuilder |
|
60 | 60 | { |
61 | 61 | return $this->customNumber(self::WEIGHT_LIGHT, $important); |
62 | 62 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @param bool $important |
67 | 67 | * @return StyleBuilder |
68 | 68 | */ |
69 | - public function normal(bool $important=false) : StyleBuilder |
|
69 | + public function normal(bool $important = false) : StyleBuilder |
|
70 | 70 | { |
71 | 71 | return $this->customNumber(self::WEIGHT_NORMAL, $important); |
72 | 72 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @param bool $important |
77 | 77 | * @return StyleBuilder |
78 | 78 | */ |
79 | - public function medium(bool $important=false) : StyleBuilder |
|
79 | + public function medium(bool $important = false) : StyleBuilder |
|
80 | 80 | { |
81 | 81 | return $this->customNumber(self::WEIGHT_MEDIUM, $important); |
82 | 82 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param bool $important |
87 | 87 | * @return StyleBuilder |
88 | 88 | */ |
89 | - public function semiBold(bool $important=false) : StyleBuilder |
|
89 | + public function semiBold(bool $important = false) : StyleBuilder |
|
90 | 90 | { |
91 | 91 | return $this->customNumber(self::WEIGHT_SEMI_BOLD, $important); |
92 | 92 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @param bool $important |
97 | 97 | * @return StyleBuilder |
98 | 98 | */ |
99 | - public function bold(bool $important=false) : StyleBuilder |
|
99 | + public function bold(bool $important = false) : StyleBuilder |
|
100 | 100 | { |
101 | 101 | return $this->customNumber(self::WEIGHT_BOLD, $important); |
102 | 102 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * @param bool $important |
107 | 107 | * @return StyleBuilder |
108 | 108 | */ |
109 | - public function extraBold(bool $important=false) : StyleBuilder |
|
109 | + public function extraBold(bool $important = false) : StyleBuilder |
|
110 | 110 | { |
111 | 111 | return $this->customNumber(self::WEIGHT_EXTRA_BOLD, $important); |
112 | 112 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @param bool $important |
117 | 117 | * @return StyleBuilder |
118 | 118 | */ |
119 | - public function black(bool $important=false) : StyleBuilder |
|
119 | + public function black(bool $important = false) : StyleBuilder |
|
120 | 120 | { |
121 | 121 | return $this->customNumber(self::WEIGHT_BLACK, $important); |
122 | 122 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @param bool $important |
131 | 131 | * @return StyleBuilder |
132 | 132 | */ |
133 | - public function namedBold(bool $important=false) : StyleBuilder |
|
133 | + public function namedBold(bool $important = false) : StyleBuilder |
|
134 | 134 | { |
135 | 135 | return $this->setStyle('bold', $important); |
136 | 136 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @param bool $important |
141 | 141 | * @return StyleBuilder |
142 | 142 | */ |
143 | - public function namedNormal(bool $important=false) : StyleBuilder |
|
143 | + public function namedNormal(bool $important = false) : StyleBuilder |
|
144 | 144 | { |
145 | 145 | return $this->setStyle('normal', $important); |
146 | 146 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @param bool $important |
151 | 151 | * @return StyleBuilder |
152 | 152 | */ |
153 | - public function relativeLighter(bool $important=false) : StyleBuilder |
|
153 | + public function relativeLighter(bool $important = false) : StyleBuilder |
|
154 | 154 | { |
155 | 155 | return $this->setStyle('lighter', $important); |
156 | 156 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @param bool $important |
161 | 161 | * @return StyleBuilder |
162 | 162 | */ |
163 | - public function relativeBolder(bool $important=false) : StyleBuilder |
|
163 | + public function relativeBolder(bool $important = false) : StyleBuilder |
|
164 | 164 | { |
165 | 165 | return $this->setStyle('bolder', $important); |
166 | 166 | } |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | $fonts[] = $fallback; |
44 | 44 | $keep = array(); |
45 | 45 | |
46 | - foreach($fonts as $font) |
|
46 | + foreach ($fonts as $font) |
|
47 | 47 | { |
48 | - if(strpos($font, ' ') !== false) |
|
48 | + if (strpos($font, ' ') !== false) |
|
49 | 49 | { |
50 | 50 | $font = "'".$font."'"; |
51 | 51 | } |
@@ -64,27 +64,27 @@ discard block |
||
64 | 64 | public const FALLBACK_CURSIVE = 'cursive'; |
65 | 65 | public const FALLBACK_FANTASY = 'fantasy'; |
66 | 66 | |
67 | - public function serif(bool $important=false) : StyleBuilder |
|
67 | + public function serif(bool $important = false) : StyleBuilder |
|
68 | 68 | { |
69 | 69 | return $this->compileStyle(self::FALLBACK_SERIF, $important); |
70 | 70 | } |
71 | 71 | |
72 | - public function sansSerif(bool $important=false) : StyleBuilder |
|
72 | + public function sansSerif(bool $important = false) : StyleBuilder |
|
73 | 73 | { |
74 | 74 | return $this->compileStyle(self::FALLBACK_SANS_SERIF, $important); |
75 | 75 | } |
76 | 76 | |
77 | - public function cursive(bool $important=false) : StyleBuilder |
|
77 | + public function cursive(bool $important = false) : StyleBuilder |
|
78 | 78 | { |
79 | 79 | return $this->compileStyle(self::FALLBACK_CURSIVE, $important); |
80 | 80 | } |
81 | 81 | |
82 | - public function monospace(bool $important=false) : StyleBuilder |
|
82 | + public function monospace(bool $important = false) : StyleBuilder |
|
83 | 83 | { |
84 | 84 | return $this->compileStyle(self::FALLBACK_MONOSPACE, $important); |
85 | 85 | } |
86 | 86 | |
87 | - public function fantasy(bool $important=false) : StyleBuilder |
|
87 | + public function fantasy(bool $important = false) : StyleBuilder |
|
88 | 88 | { |
89 | 89 | return $this->compileStyle(self::FALLBACK_FANTASY, $important); |
90 | 90 | } |