Skip to content

Commit 25bfff3

Browse files
committed
Changes suggested in review
1 parent 66e6be3 commit 25bfff3

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/Value/Color.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,12 @@ private function allComponentsAreNumbers(): bool
253253

254254
/**
255255
* Note that this method assumes the following:
256-
* - The {@see aComponents} array has keys for `r`, `g` and `b`;
257-
* - The values in the array are all instances of {@see Size}.
256+
* - The `aComponents` array has keys for `r`, `g` and `b`;
257+
* - The values in the array are all instances of `Size`.
258258
*
259259
* Errors will be triggered or thrown if this is not the case.
260+
*
261+
* @return non-empty-string
260262
*/
261263
private function renderAsHex(): string
262264
{
@@ -266,7 +268,8 @@ private function renderAsHex(): string
266268
$this->aComponents['g']->getSize(),
267269
$this->aComponents['b']->getSize()
268270
);
269-
return '#' . (($result[0] == $result[1]) && ($result[2] == $result[3]) && ($result[4] == $result[5])
270-
? "$result[0]$result[2]$result[4]" : $result);
271+
$canUseShortVariant = ($result[0] == $result[1]) && ($result[2] == $result[3]) && ($result[4] == $result[5]);
272+
273+
return '#' . ($canUseShortVariant ? $result[0] . $result[2] . $result[4] : $result);
271274
}
272275
}

0 commit comments

Comments
 (0)