Skip to content

Commit 6a5d8be

Browse files
committed
[CLEANUP] Avoid Hungarian notation for size
Part of #756
1 parent 2c3fe72 commit 6a5d8be

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/Value/Size.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class Size extends PrimitiveValue
5555
/**
5656
* @var float
5757
*/
58-
private $fSize;
58+
private $size;
5959

6060
/**
6161
* @var string|null
@@ -68,15 +68,15 @@ class Size extends PrimitiveValue
6868
private $bIsColorComponent;
6969

7070
/**
71-
* @param float|int|string $fSize
71+
* @param float|int|string $size
7272
* @param string|null $sUnit
7373
* @param bool $bIsColorComponent
7474
* @param int<0, max> $lineNumber
7575
*/
76-
public function __construct($fSize, $sUnit = null, $bIsColorComponent = false, $lineNumber = 0)
76+
public function __construct($size, $sUnit = null, $bIsColorComponent = false, $lineNumber = 0)
7777
{
7878
parent::__construct($lineNumber);
79-
$this->fSize = (float) $fSize;
79+
$this->size = (float) $size;
8080
$this->sUnit = $sUnit;
8181
$this->bIsColorComponent = $bIsColorComponent;
8282
}
@@ -91,22 +91,22 @@ public function __construct($fSize, $sUnit = null, $bIsColorComponent = false, $
9191
*/
9292
public static function parse(ParserState $parserState, $bIsColorComponent = false): Size
9393
{
94-
$sSize = '';
94+
$size = '';
9595
if ($parserState->comes('-')) {
96-
$sSize .= $parserState->consume('-');
96+
$size .= $parserState->consume('-');
9797
}
9898
while (\is_numeric($parserState->peek()) || $parserState->comes('.') || $parserState->comes('e', true)) {
9999
if ($parserState->comes('.')) {
100-
$sSize .= $parserState->consume('.');
100+
$size .= $parserState->consume('.');
101101
} elseif ($parserState->comes('e', true)) {
102102
$sLookahead = $parserState->peek(1, 1);
103103
if (\is_numeric($sLookahead) || $sLookahead === '+' || $sLookahead === '-') {
104-
$sSize .= $parserState->consume(2);
104+
$size .= $parserState->consume(2);
105105
} else {
106106
break; // Reached the unit part of the number like "em" or "ex"
107107
}
108108
} else {
109-
$sSize .= $parserState->consume(1);
109+
$size .= $parserState->consume(1);
110110
}
111111
}
112112

@@ -121,7 +121,7 @@ public static function parse(ParserState $parserState, $bIsColorComponent = fals
121121
}
122122
}
123123
}
124-
return new Size((float) $sSize, $sUnit, $bIsColorComponent, $parserState->currentLine());
124+
return new Size((float) $size, $sUnit, $bIsColorComponent, $parserState->currentLine());
125125
}
126126

127127
/**
@@ -162,19 +162,19 @@ public function getUnit()
162162
}
163163

164164
/**
165-
* @param float|int|string $fSize
165+
* @param float|int|string $size
166166
*/
167-
public function setSize($fSize): void
167+
public function setSize($size): void
168168
{
169-
$this->fSize = (float) $fSize;
169+
$this->size = (float) $size;
170170
}
171171

172172
/**
173173
* @return float
174174
*/
175175
public function getSize()
176176
{
177-
return $this->fSize;
177+
return $this->size;
178178
}
179179

180180
/**
@@ -204,7 +204,7 @@ public function isRelative(): bool
204204
if (\in_array($this->sUnit, self::RELATIVE_SIZE_UNITS, true)) {
205205
return true;
206206
}
207-
if ($this->sUnit === null && $this->fSize != 0) {
207+
if ($this->sUnit === null && $this->size != 0) {
208208
return true;
209209
}
210210
return false;
@@ -222,9 +222,9 @@ public function render(OutputFormat $outputFormat): string
222222
{
223223
$l = \localeconv();
224224
$sPoint = \preg_quote($l['decimal_point'], '/');
225-
$sSize = \preg_match('/[\\d\\.]+e[+-]?\\d+/i', (string) $this->fSize)
226-
? \preg_replace("/$sPoint?0+$/", '', \sprintf('%f', $this->fSize)) : (string) $this->fSize;
227-
return \preg_replace(["/$sPoint/", '/^(-?)0\\./'], ['.', '$1.'], $sSize)
225+
$size = \preg_match('/[\\d\\.]+e[+-]?\\d+/i', (string) $this->size)
226+
? \preg_replace("/$sPoint?0+$/", '', \sprintf('%f', $this->size)) : (string) $this->size;
227+
return \preg_replace(["/$sPoint/", '/^(-?)0\\./'], ['.', '$1.'], $size)
228228
. ($this->sUnit ?? '');
229229
}
230230
}

0 commit comments

Comments
 (0)