summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichal Čihař <michal@cihar.com>2016-09-13 16:25:24 +0200
committerGitHub <noreply@github.com>2016-09-13 16:25:24 +0200
commit8ca9a1b02e865f18d00c2c1a0d078ede28cf71c9 (patch)
tree59d7fc2b7ec12e12d3181cb8b57c9dbb99340d20 /src
parent00e0a65544a7e29d7e1fe6ffb682382667084ba1 (diff)
parentc7f2d0c0a2621c20d3a8b527de9ca392e53c2def (diff)
downloadsql-parser-8ca9a1b02e865f18d00c2c1a0d078ede28cf71c9.zip
sql-parser-8ca9a1b02e865f18d00c2c1a0d078ede28cf71c9.tar.gz
sql-parser-8ca9a1b02e865f18d00c2c1a0d078ede28cf71c9.tar.bz2
Merge pull request #82 from remicollet/issue-newline
fix default options in Formater constructor
Diffstat (limited to 'src')
-rw-r--r--src/Utils/Formatter.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Utils/Formatter.php b/src/Utils/Formatter.php
index 56691eb..f82ef13 100644
--- a/src/Utils/Formatter.php
+++ b/src/Utils/Formatter.php
@@ -73,7 +73,7 @@ class Formatter
*
* @var string
*/
- 'line_ending' => $this->options['type'] == 'html' ? '<br/>' : "\n",
+ 'line_ending' => NULL,
/**
* The string used for indentation.
@@ -172,6 +172,10 @@ class Formatter
$options
);
+ if (is_null($this->options['line_ending'])) {
+ $this->options['line_ending'] = $this->options['type'] == 'html' ? '<br/>' : "\n";
+ }
+
// `parts_newline` requires `clause_newline`
$this->options['parts_newline'] &= $this->options['clause_newline'];
}