Skip to content

Commit 7915972

Browse files
committed
Removed duplicated method for NewLine
1 parent d63447a commit 7915972

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

src/Formatter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function format($sql)
132132
$this->newLine->addNewLineAfterOpeningParentheses();
133133
} elseif ($this->parentheses->stringIsClosingParentheses($token)) {
134134
$this->indentation->decreaseIndentLevelUntilIndentTypeIsSpecial($this);
135-
$this->newLine->addNewLineBeforeClosingParentheses($addedNewline, $tab);
135+
$this->newLine->addNewLineBeforeToken($addedNewline, $tab);
136136
} elseif ($this->isTokenTypeReservedTopLevel($token)) {
137137
$this->indentation
138138
->setIncreaseSpecialIndent(true)
@@ -152,7 +152,7 @@ public function format($sql)
152152
) {
153153
$this->newLine->writeNewLineBecauseOfComma();
154154
} elseif ($this->newLine->isTokenTypeReservedNewLine($token)) {
155-
$this->newLine->writeNewLineBeforeReservedWord($addedNewline, $tab);
155+
$this->newLine->addNewLineBeforeToken($addedNewline, $tab);
156156

157157
if (WhiteSpace::tokenHasExtraWhiteSpaces($token)) {
158158
$queryValue = preg_replace('/\s+/', ' ', $queryValue);

src/Helper/NewLine.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function addNewLineAfterOpeningParentheses()
112112
* @param boolean $addedNewline
113113
* @param string $tab
114114
*/
115-
public function addNewLineBeforeClosingParentheses($addedNewline, $tab)
115+
public function addNewLineBeforeToken($addedNewline, $tab)
116116
{
117117
if (false === $addedNewline) {
118118
$this->formatter->appendToFormattedSql(
@@ -164,17 +164,6 @@ public function isTokenTypeReservedNewLine($token)
164164
return $token[Tokenizer::TOKEN_TYPE] === Tokenizer::TOKEN_TYPE_RESERVED_NEWLINE;
165165
}
166166

167-
/**
168-
* @param boolean $addedNewline
169-
* @param string $tab
170-
*/
171-
public function writeNewLineBeforeReservedWord($addedNewline, $tab)
172-
{
173-
if (false === $addedNewline) {
174-
$this->formatter->appendToFormattedSql("\n" . str_repeat($tab, $this->indentation->getIndentLvl()));
175-
}
176-
}
177-
178167
/**
179168
* @return boolean
180169
*/

0 commit comments

Comments
 (0)