Skip to content

Commit 9f7bbbe

Browse files
authored
[CLEANUP] Improve some OutputFormat property and getter names (#1099)
As suggested in #1098. The setters are not changed as those are part of the public API.
1 parent b4d691c commit 9f7bbbe

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

src/OutputFormat.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class OutputFormat
1818
*
1919
* @var bool
2020
*/
21-
private $rgbHashNotation = true;
21+
private $usesRgbHashNotation = true;
2222

2323
/**
2424
* Declaration format
@@ -27,7 +27,7 @@ class OutputFormat
2727
*
2828
* @var bool
2929
*/
30-
private $semicolonAfterLastRule = true;
30+
private $renderSemicolonAfterLastRule = true;
3131

3232
/**
3333
* Spacing
@@ -272,35 +272,35 @@ public function setStringQuotingType(string $quotingType): self
272272
/**
273273
* @internal
274274
*/
275-
public function getRGBHashNotation(): bool
275+
public function usesRgbHashNotation(): bool
276276
{
277-
return $this->rgbHashNotation;
277+
return $this->usesRgbHashNotation;
278278
}
279279

280280
/**
281281
* @return $this fluent interface
282282
*/
283-
public function setRGBHashNotation(bool $rgbHashNotation): self
283+
public function setRGBHashNotation(bool $usesRgbHashNotation): self
284284
{
285-
$this->rgbHashNotation = $rgbHashNotation;
285+
$this->usesRgbHashNotation = $usesRgbHashNotation;
286286

287287
return $this;
288288
}
289289

290290
/**
291291
* @internal
292292
*/
293-
public function getSemicolonAfterLastRule(): bool
293+
public function shouldRenderSemicolonAfterLastRule(): bool
294294
{
295-
return $this->semicolonAfterLastRule;
295+
return $this->renderSemicolonAfterLastRule;
296296
}
297297

298298
/**
299299
* @return $this fluent interface
300300
*/
301-
public function setSemicolonAfterLastRule(bool $semicolonAfterLastRule): self
301+
public function setSemicolonAfterLastRule(bool $renderSemicolonAfterLastRule): self
302302
{
303-
$this->semicolonAfterLastRule = $semicolonAfterLastRule;
303+
$this->renderSemicolonAfterLastRule = $renderSemicolonAfterLastRule;
304304

305305
return $this;
306306
}

src/OutputFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public function implode(string $separator, array $values, bool $increaseLevel =
191191

192192
public function removeLastSemicolon(string $string): string
193193
{
194-
if ($this->outputFormat->getSemicolonAfterLastRule()) {
194+
if ($this->outputFormat->shouldRenderSemicolonAfterLastRule()) {
195195
return $string;
196196
}
197197

src/Value/Color.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public function render(OutputFormat $outputFormat): string
248248
private function shouldRenderAsHex(OutputFormat $outputFormat): bool
249249
{
250250
return
251-
$outputFormat->getRGBHashNotation()
251+
$outputFormat->usesRgbHashNotation()
252252
&& $this->getRealName() === 'rgb'
253253
&& $this->allComponentsAreNumbers();
254254
}

tests/Unit/OutputFormatTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ public function setStringQuotingTypeProvidesFluentInterface(): void
5353
/**
5454
* @test
5555
*/
56-
public function getRGBHashNotationInitiallyReturnsTrue(): void
56+
public function usesRgbHashNotationInitiallyReturnsTrue(): void
5757
{
58-
self::assertTrue($this->subject->getRGBHashNotation());
58+
self::assertTrue($this->subject->usesRgbHashNotation());
5959
}
6060

6161
/**
@@ -78,7 +78,7 @@ public function setRGBHashNotationSetsRGBHashNotation(bool $value): void
7878
{
7979
$this->subject->setRGBHashNotation($value);
8080

81-
self::assertSame($value, $this->subject->getRGBHashNotation());
81+
self::assertSame($value, $this->subject->usesRgbHashNotation());
8282
}
8383

8484
/**
@@ -92,9 +92,9 @@ public function setRGBHashNotationProvidesFluentInterface(): void
9292
/**
9393
* @test
9494
*/
95-
public function getSemicolonAfterLastRuleInitiallyReturnsTrue(): void
95+
public function shouldRenderSemicolonAfterLastRuleInitiallyReturnsTrue(): void
9696
{
97-
self::assertTrue($this->subject->getSemicolonAfterLastRule());
97+
self::assertTrue($this->subject->shouldRenderSemicolonAfterLastRule());
9898
}
9999

100100
/**
@@ -106,7 +106,7 @@ public function setSemicolonAfterLastRuleSetsSemicolonAfterLastRule(bool $value)
106106
{
107107
$this->subject->setSemicolonAfterLastRule($value);
108108

109-
self::assertSame($value, $this->subject->getSemicolonAfterLastRule());
109+
self::assertSame($value, $this->subject->shouldRenderSemicolonAfterLastRule());
110110
}
111111

112112
/**

0 commit comments

Comments
 (0)