Skip to content

Commit df57a6a

Browse files
author
Alexandra Nantel
committed
SQL and PHP cases
PHP true,false,null in lowercase SQL keywords uppercase
1 parent 6e8c376 commit df57a6a

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

lib/bitter/formats/symphony.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,104 @@
11
<?php
22
/*----------------------------------------------------------------------------*/
3-
3+
44
class BitterFormatSymphony extends BitterFormat {
55
protected $tabsize = 4;
66
protected $line = 1;
77
protected $output = '';
8-
8+
99
public function process($source) {
1010
$this->output = $source;
11-
11+
1212
$this->processTabs();
1313
$this->processLines();
14-
14+
1515
return sprintf(
1616
'<pre>%s</pre>',
1717
$this->output
1818
);
1919
}
20-
20+
2121
protected function processTabs() {
2222
// first split the output into manageable chunks
2323
$lines = explode(PHP_EOL, $this->output);
2424
$linesCount = count($lines);
2525
// fix lines one by one
2626
for ($x = 0; $x < $linesCount; $x++) {
2727
// while there are still tabs
28-
while (strpos($lines[$x], "\t") !== FALSE) {
28+
while (strpos($lines[$x], "\t") !== false) {
2929
// replace tabs for spaces
3030
$lines[$x] = preg_replace_callback('%^([^\t]*)([\t]+)%', array($this, 'processTabsLine'), $lines[$x]);
3131
}
3232
}
3333
// concat the final output
3434
$this->output = implode(PHP_EOL, $lines);
3535
}
36-
36+
3737
protected function processTabsLine($matches) {
3838
return $matches[1] . str_repeat(
3939
' ', strlen($matches[2]) * $this->tabsize
4040
);
4141
}
42-
42+
4343
protected function processLines() {
4444
$tokens = preg_split('%(<span class=".*?">|</span>)%', $this->output, 0, PREG_SPLIT_DELIM_CAPTURE);
4545
$stack = array(); $this->output = '';
46-
46+
4747
$this->startLine();
48-
48+
4949
foreach ($tokens as $token) {
5050
// Close:
5151
if (preg_match('%^</%', $token)) {
5252
array_pop($stack);
5353
$this->output .= $token;
5454
}
55-
55+
5656
// Open:
5757
else if (preg_match('%^<%', $token)) {
5858
array_push($stack, $token);
5959
$this->output .= $token;
6060
}
61-
61+
6262
else {
6363
$characters = preg_split('//', $token);
64-
64+
6565
foreach ($characters as $character) {
6666
if ($character == "\n") {
6767
$this->endLine();
68-
68+
6969
foreach ($stack as $alt_token) $this->output .= '</span>';
7070
}
71-
71+
7272
$this->output .= $character;
73-
73+
7474
if ($character == "\n") {
7575
$this->startLine();
76-
76+
7777
foreach ($stack as $alt_token) $this->output .= $alt_token;
7878
}
7979
}
8080
}
8181
}
82-
82+
8383
$this->endLine();
8484
}
85-
85+
8686
protected function startLine() {
8787
$this->output .= "<line id=\"{$this->line}\">";
8888
$this->output .= "<marker></marker>";
8989
$this->output .= "<content>";
9090
}
91-
91+
9292
protected function endLine() {
9393
$this->line++;
9494
$this->output .= '</content>';
9595
$this->output .= '</line>';
9696
}
9797
}
98-
98+
9999
/*----------------------------------------------------------------------------*/
100-
100+
101101
return new BitterFormatSymphony();
102-
102+
103103
/*----------------------------------------------------------------------------*/
104-
?>
104+
?>

0 commit comments

Comments
 (0)