Skip to content

Commit 17dd3cb

Browse files
authored
[CLEANUP] Avoid Hungarian notation for outputFormat(ter) (#942)
Part of #756
1 parent 631c07e commit 17dd3cb

File tree

2 files changed

+21
-20
lines changed

2 files changed

+21
-20
lines changed

src/OutputFormat.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ class OutputFormat
3939
* Spacing
4040
* Note that these strings are not sanity-checked: the value should only consist of whitespace
4141
* Any newline character will be indented according to the current level.
42-
* The triples (After, Before, Between) can be set using a wildcard (e.g. `$oFormat->set('Space*Rules', "\n");`)
42+
* The triples (After, Before, Between) can be set using a wildcard
43+
* (e.g. `$outputFormat->set('Space*Rules', "\n");`)
4344
*
4445
* @var string
4546
*
@@ -217,7 +218,7 @@ class OutputFormat
217218
/**
218219
* @var OutputFormatter|null
219220
*/
220-
private $oFormatter;
221+
private $outputFormatter;
221222

222223
/**
223224
* @var OutputFormat|null
@@ -788,7 +789,7 @@ public function nextLevel(): self
788789
if ($this->oNextLevelFormat === null) {
789790
$this->oNextLevelFormat = clone $this;
790791
$this->oNextLevelFormat->iIndentationLevel++;
791-
$this->oNextLevelFormat->oFormatter = null;
792+
$this->oNextLevelFormat->outputFormatter = null;
792793
}
793794
return $this->oNextLevelFormat;
794795
}
@@ -800,10 +801,10 @@ public function beLenient(): void
800801

801802
public function getFormatter(): OutputFormatter
802803
{
803-
if ($this->oFormatter === null) {
804-
$this->oFormatter = new OutputFormatter($this);
804+
if ($this->outputFormatter === null) {
805+
$this->outputFormatter = new OutputFormatter($this);
805806
}
806-
return $this->oFormatter;
807+
return $this->outputFormatter;
807808
}
808809

809810
/**

src/OutputFormatter.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ class OutputFormatter
1212
/**
1313
* @var OutputFormat
1414
*/
15-
private $oFormat;
15+
private $outputFormat;
1616

17-
public function __construct(OutputFormat $oFormat)
17+
public function __construct(OutputFormat $outputFormat)
1818
{
19-
$this->oFormat = $oFormat;
19+
$this->outputFormat = $outputFormat;
2020
}
2121

2222
/**
@@ -25,7 +25,7 @@ public function __construct(OutputFormat $oFormat)
2525
*/
2626
public function space($sName, $sType = null): string
2727
{
28-
$sSpaceString = $this->oFormat->get("Space$sName");
28+
$sSpaceString = $this->outputFormat->get("Space$sName");
2929
// If $sSpaceString is an array, we have multiple values configured
3030
// depending on the type of object the space applies to
3131
if (\is_array($sSpaceString)) {
@@ -91,7 +91,7 @@ public function spaceAfterSelectorSeparator(): string
9191
*/
9292
public function spaceBeforeListArgumentSeparator($sSeparator): string
9393
{
94-
$spaceForSeparator = $this->oFormat->getSpaceBeforeListArgumentSeparators();
94+
$spaceForSeparator = $this->outputFormat->getSpaceBeforeListArgumentSeparators();
9595

9696
return $spaceForSeparator[$sSeparator] ?? $this->space('BeforeListArgumentSeparator', $sSeparator);
9797
}
@@ -101,7 +101,7 @@ public function spaceBeforeListArgumentSeparator($sSeparator): string
101101
*/
102102
public function spaceAfterListArgumentSeparator($sSeparator): string
103103
{
104-
$spaceForSeparator = $this->oFormat->getSpaceAfterListArgumentSeparators();
104+
$spaceForSeparator = $this->outputFormat->getSpaceAfterListArgumentSeparators();
105105

106106
return $spaceForSeparator[$sSeparator] ?? $this->space('AfterListArgumentSeparator', $sSeparator);
107107
}
@@ -120,7 +120,7 @@ public function spaceBeforeOpeningBrace(): string
120120
*/
121121
public function safely($cCode)
122122
{
123-
if ($this->oFormat->get('IgnoreExceptions')) {
123+
if ($this->outputFormat->get('IgnoreExceptions')) {
124124
// If output exceptions are ignored, run the code with exception guards
125125
try {
126126
return $cCode();
@@ -142,9 +142,9 @@ public function safely($cCode)
142142
public function implode(string $sSeparator, array $aValues, $bIncreaseLevel = false): string
143143
{
144144
$result = '';
145-
$oFormat = $this->oFormat;
145+
$outputFormat = $this->outputFormat;
146146
if ($bIncreaseLevel) {
147-
$oFormat = $oFormat->nextLevel();
147+
$outputFormat = $outputFormat->nextLevel();
148148
}
149149
$bIsFirst = true;
150150
foreach ($aValues as $mValue) {
@@ -154,7 +154,7 @@ public function implode(string $sSeparator, array $aValues, $bIncreaseLevel = fa
154154
$result .= $sSeparator;
155155
}
156156
if ($mValue instanceof Renderable) {
157-
$result .= $mValue->render($oFormat);
157+
$result .= $mValue->render($outputFormat);
158158
} else {
159159
$result .= $mValue;
160160
}
@@ -169,7 +169,7 @@ public function implode(string $sSeparator, array $aValues, $bIncreaseLevel = fa
169169
*/
170170
public function removeLastSemicolon($sString)
171171
{
172-
if ($this->oFormat->get('SemicolonAfterLastRule')) {
172+
if ($this->outputFormat->get('SemicolonAfterLastRule')) {
173173
return $sString;
174174
}
175175
$sString = \explode(';', $sString);
@@ -184,7 +184,7 @@ public function removeLastSemicolon($sString)
184184

185185
public function comments(Commentable $oCommentable): string
186186
{
187-
if (!$this->oFormat->bRenderComments) {
187+
if (!$this->outputFormat->bRenderComments) {
188188
return '';
189189
}
190190

@@ -193,7 +193,7 @@ public function comments(Commentable $oCommentable): string
193193
$iLastCommentIndex = \count($comments) - 1;
194194

195195
foreach ($comments as $i => $oComment) {
196-
$result .= $oComment->render($this->oFormat);
196+
$result .= $oComment->render($this->outputFormat);
197197
$result .= $i === $iLastCommentIndex ? $this->spaceAfterBlocks() : $this->spaceBetweenBlocks();
198198
}
199199
return $result;
@@ -212,6 +212,6 @@ private function prepareSpace($sSpaceString): string
212212
*/
213213
private function indent(): string
214214
{
215-
return \str_repeat($this->oFormat->sIndentation, $this->oFormat->getIndentationLevel());
215+
return \str_repeat($this->outputFormat->sIndentation, $this->outputFormat->getIndentationLevel());
216216
}
217217
}

0 commit comments

Comments
 (0)