@@ -51,7 +51,7 @@ |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | //require_once 'Text/Diff/Engine/' . $engine . '.php'; |
54 | - $class = 'Text_Diff_Engine_' . $engine; |
|
54 | + $class = 'Text_Diff_Engine_'.$engine; |
|
55 | 55 | $diff_engine = new $class(); |
56 | 56 | |
57 | 57 | $this->_edits = call_user_func_array(array($diff_engine, 'diff'), $params); |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | if ($edit->isConflict()) { |
59 | 59 | /* FIXME: this should probably be moved somewhere else. */ |
60 | 60 | $lines = array_merge($lines, |
61 | - array('<<<<<<<' . ($label1 ? ' ' . $label1 : '')), |
|
61 | + array('<<<<<<<'.($label1 ? ' '.$label1 : '')), |
|
62 | 62 | $edit->final1, |
63 | 63 | array("======="), |
64 | 64 | $edit->final2, |
65 | - array('>>>>>>>' . ($label2 ? ' ' . $label2 : ''))); |
|
65 | + array('>>>>>>>'.($label2 ? ' '.$label2 : ''))); |
|
66 | 66 | $this->_conflictingBlocks++; |
67 | 67 | } else { |
68 | 68 | $lines = array_merge($lines, $edit->merged()); |
@@ -126,11 +126,11 @@ discard block |
||
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
129 | - if ($e1 && ! $e1->orig) { |
|
129 | + if ($e1 && !$e1->orig) { |
|
130 | 130 | $bb->out1($e1->final); |
131 | 131 | $e1 = next($edits1); |
132 | 132 | } |
133 | - if ($e2 && ! $e2->orig) { |
|
133 | + if ($e2 && !$e2->orig) { |
|
134 | 134 | $bb->out2($e2->final); |
135 | 135 | $e2 = next($edits2); |
136 | 136 | } |
@@ -35,10 +35,10 @@ |
||
35 | 35 | function _blockHeader($xbeg, $xlen, $ybeg, $ylen) |
36 | 36 | { |
37 | 37 | if ($xlen != 1) { |
38 | - $xbeg .= ',' . $xlen; |
|
38 | + $xbeg .= ','.$xlen; |
|
39 | 39 | } |
40 | 40 | if ($ylen != 1) { |
41 | - $ybeg .= ',' . $ylen; |
|
41 | + $ybeg .= ','.$ylen; |
|
42 | 42 | } |
43 | 43 | $this->_second_block = "--- $ybeg ----\n"; |
44 | 44 | return "***************\n*** $xbeg ****"; |
@@ -83,14 +83,14 @@ discard block |
||
83 | 83 | if ($this->_split_level == 'words') { |
84 | 84 | return implode('', $lines); |
85 | 85 | } else { |
86 | - return implode("\n", $lines) . "\n"; |
|
86 | + return implode("\n", $lines)."\n"; |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
90 | 90 | function _added($lines) |
91 | 91 | { |
92 | 92 | array_walk($lines, array(&$this, '_encode')); |
93 | - $lines[0] = $this->_ins_prefix . $lines[0]; |
|
93 | + $lines[0] = $this->_ins_prefix.$lines[0]; |
|
94 | 94 | $lines[count($lines) - 1] .= $this->_ins_suffix; |
95 | 95 | return $this->_lines($lines, ' ', false); |
96 | 96 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | function _deleted($lines, $words = false) |
99 | 99 | { |
100 | 100 | array_walk($lines, array(&$this, '_encode')); |
101 | - $lines[0] = $this->_del_prefix . $lines[0]; |
|
101 | + $lines[0] = $this->_del_prefix.$lines[0]; |
|
102 | 102 | $lines[count($lines) - 1] .= $this->_del_suffix; |
103 | 103 | return $this->_lines($lines, ' ', false); |
104 | 104 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $orig[0] = substr($orig[0], 1); |
117 | 117 | $final[0] = substr($final[0], 1); |
118 | 118 | } |
119 | - return $prefix . $this->_deleted($orig) . $this->_added($final); |
|
119 | + return $prefix.$this->_deleted($orig).$this->_added($final); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | $text1 = implode("\n", $orig); |
@@ -133,12 +133,11 @@ discard block |
||
133 | 133 | $this->_splitOnWords($text2, $nl))); |
134 | 134 | |
135 | 135 | /* Get the diff in inline format. */ |
136 | - $renderer = new Text_Diff_Renderer_inline |
|
137 | - (array_merge($this->getParams(), |
|
136 | + $renderer = new Text_Diff_Renderer_inline(array_merge($this->getParams(), |
|
138 | 137 | array('split_level' => 'words'))); |
139 | 138 | |
140 | 139 | /* Run the diff and get the output. */ |
141 | - return str_replace($nl, "\n", $renderer->render($diff)) . "\n"; |
|
140 | + return str_replace($nl, "\n", $renderer->render($diff))."\n"; |
|
142 | 141 | } |
143 | 142 | |
144 | 143 | function _splitOnWords($string, $newlineEscape = "\n") |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | function _blockHeader($xbeg, $xlen, $ybeg, $ylen) |
35 | 35 | { |
36 | 36 | if ($xlen != 1) { |
37 | - $xbeg .= ',' . $xlen; |
|
37 | + $xbeg .= ','.$xlen; |
|
38 | 38 | } |
39 | 39 | if ($ylen != 1) { |
40 | - $ybeg .= ',' . $ylen; |
|
40 | + $ybeg .= ','.$ylen; |
|
41 | 41 | } |
42 | 42 | return "@@ -$xbeg +$ybeg @@"; |
43 | 43 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | function _changed($orig, $final) |
61 | 61 | { |
62 | - return $this->_deleted($orig) . $this->_added($final); |
|
62 | + return $this->_deleted($orig).$this->_added($final); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | function Text_Diff_Renderer($params = array()) |
39 | 39 | { |
40 | 40 | foreach ($params as $param => $value) { |
41 | - $v = '_' . $param; |
|
41 | + $v = '_'.$param; |
|
42 | 42 | if (isset($this->$v)) { |
43 | 43 | $this->$v = $value; |
44 | 44 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $block); |
141 | 141 | } |
142 | 142 | |
143 | - return $output . $this->_endDiff(); |
|
143 | + return $output.$this->_endDiff(); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | function _block($xbeg, $xlen, $ybeg, $ylen, &$edits) |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
170 | - return $output . $this->_endBlock(); |
|
170 | + return $output.$this->_endBlock(); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | function _startDiff() |
@@ -183,10 +183,10 @@ discard block |
||
183 | 183 | function _blockHeader($xbeg, $xlen, $ybeg, $ylen) |
184 | 184 | { |
185 | 185 | if ($xlen > 1) { |
186 | - $xbeg .= ',' . ($xbeg + $xlen - 1); |
|
186 | + $xbeg .= ','.($xbeg + $xlen - 1); |
|
187 | 187 | } |
188 | 188 | if ($ylen > 1) { |
189 | - $ybeg .= ',' . ($ybeg + $ylen - 1); |
|
189 | + $ybeg .= ','.($ybeg + $ylen - 1); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | // this matches the GNU Diff behaviour |
@@ -196,12 +196,12 @@ discard block |
||
196 | 196 | $xbeg--; |
197 | 197 | } |
198 | 198 | |
199 | - return $xbeg . ($xlen ? ($ylen ? 'c' : 'd') : 'a') . $ybeg; |
|
199 | + return $xbeg.($xlen ? ($ylen ? 'c' : 'd') : 'a').$ybeg; |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | function _startBlock($header) |
203 | 203 | { |
204 | - return $header . "\n"; |
|
204 | + return $header."\n"; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | function _endBlock() |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | |
212 | 212 | function _lines($lines, $prefix = ' ') |
213 | 213 | { |
214 | - return $prefix . implode("\n$prefix", $lines) . "\n"; |
|
214 | + return $prefix.implode("\n$prefix", $lines)."\n"; |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | function _context($lines) |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | |
232 | 232 | function _changed($orig, $final) |
233 | 233 | { |
234 | - return $this->_deleted($orig) . "---\n" . $this->_added($final); |
|
234 | + return $this->_deleted($orig)."---\n".$this->_added($final); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * match. The caller must trim matching lines from the beginning and end |
149 | 149 | * of the portions it is going to specify. |
150 | 150 | */ |
151 | - function _diag ($xoff, $xlim, $yoff, $ylim, $nchunks) |
|
151 | + function _diag($xoff, $xlim, $yoff, $ylim, $nchunks) |
|
152 | 152 | { |
153 | 153 | $flip = false; |
154 | 154 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | } |
172 | 172 | |
173 | 173 | $this->lcs = 0; |
174 | - $this->seq[0]= $yoff - 1; |
|
174 | + $this->seq[0] = $yoff - 1; |
|
175 | 175 | $this->in_seq = array(); |
176 | 176 | $ymids[0] = array(); |
177 | 177 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
187 | - $x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $chunk) / $nchunks); |
|
187 | + $x1 = $xoff + (int) (($numer + ($xlim - $xoff) * $chunk) / $nchunks); |
|
188 | 188 | for (; $x < $x1; $x++) { |
189 | 189 | $line = $flip ? $this->yv[$x] : $this->xv[$x]; |
190 | 190 | if (empty($ymatches[$line])) { |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | $seps[] = $flip ? array($yoff, $xoff) : array($xoff, $yoff); |
221 | 221 | $ymid = $ymids[$this->lcs]; |
222 | 222 | for ($n = 0; $n < $nchunks - 1; $n++) { |
223 | - $x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $n) / $nchunks); |
|
223 | + $x1 = $xoff + (int) (($numer + ($xlim - $xoff) * $n) / $nchunks); |
|
224 | 224 | $y1 = $ymid[$n] + 1; |
225 | 225 | $seps[] = $flip ? array($y1, $x1) : array($x1, $y1); |
226 | 226 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | $beg = 1; |
242 | 242 | while ($beg < $end) { |
243 | - $mid = (int)(($beg + $end) / 2); |
|
243 | + $mid = (int) (($beg + $end) / 2); |
|
244 | 244 | if ($ypos > $this->seq[$mid]) { |
245 | 245 | $beg = $mid + 1; |
246 | 246 | } else { |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | * Note that XLIM, YLIM are exclusive bounds. All line numbers are |
269 | 269 | * origin-0 and discarded lines are not counted. |
270 | 270 | */ |
271 | - function _compareseq ($xoff, $xlim, $yoff, $ylim) |
|
271 | + function _compareseq($xoff, $xlim, $yoff, $ylim) |
|
272 | 272 | { |
273 | 273 | /* Slide down the bottom initial diagonal. */ |
274 | 274 | while ($xoff < $xlim && $yoff < $ylim |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | reset($seps); |
310 | 310 | $pt1 = $seps[0]; |
311 | 311 | while ($pt2 = next($seps)) { |
312 | - $this->_compareseq ($pt1[0], $pt2[0], $pt1[1], $pt2[1]); |
|
312 | + $this->_compareseq($pt1[0], $pt2[0], $pt1[1], $pt2[1]); |
|
313 | 313 | $pt1 = $pt2; |
314 | 314 | } |
315 | 315 | } |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | $j++; |
353 | 353 | } |
354 | 354 | |
355 | - while ($i < $len && ! $changed[$i]) { |
|
355 | + while ($i < $len && !$changed[$i]) { |
|
356 | 356 | assert('$j < $other_len && ! $other_changed[$j]'); |
357 | 357 | $i++; $j++; |
358 | 358 | while ($j < $other_len && $other_changed[$j]) { |
@@ -49,7 +49,7 @@ |
||
49 | 49 | $fp = fopen($to_file, 'w'); |
50 | 50 | fwrite($fp, implode("\n", $to_lines)); |
51 | 51 | fclose($fp); |
52 | - $diff = shell_exec($this->_diffCommand . ' ' . $from_file . ' ' . $to_file); |
|
52 | + $diff = shell_exec($this->_diffCommand.' '.$from_file.' '.$to_file); |
|
53 | 53 | unlink($from_file); |
54 | 54 | unlink($to_file); |
55 | 55 |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | /**#@+ |
27 | 27 | * ERROR constants |
28 | 28 | */ |
29 | -define('PEAR_ERROR_RETURN', 1); |
|
30 | -define('PEAR_ERROR_PRINT', 2); |
|
31 | -define('PEAR_ERROR_TRIGGER', 4); |
|
32 | -define('PEAR_ERROR_DIE', 8); |
|
33 | -define('PEAR_ERROR_CALLBACK', 16); |
|
29 | +define('PEAR_ERROR_RETURN', 1); |
|
30 | +define('PEAR_ERROR_PRINT', 2); |
|
31 | +define('PEAR_ERROR_TRIGGER', 4); |
|
32 | +define('PEAR_ERROR_DIE', 8); |
|
33 | +define('PEAR_ERROR_CALLBACK', 16); |
|
34 | 34 | /** |
35 | 35 | * WARNING: obsolete |
36 | 36 | * @deprecated |
@@ -42,12 +42,12 @@ discard block |
||
42 | 42 | |
43 | 43 | if (substr(PHP_OS, 0, 3) == 'WIN') { |
44 | 44 | define('OS_WINDOWS', true); |
45 | - define('OS_UNIX', false); |
|
46 | - define('PEAR_OS', 'Windows'); |
|
45 | + define('OS_UNIX', false); |
|
46 | + define('PEAR_OS', 'Windows'); |
|
47 | 47 | } else { |
48 | 48 | define('OS_WINDOWS', false); |
49 | - define('OS_UNIX', true); |
|
50 | - define('PEAR_OS', 'Unix'); // blatant assumption |
|
49 | + define('OS_UNIX', true); |
|
50 | + define('PEAR_OS', 'Unix'); // blatant assumption |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | $GLOBALS['_PEAR_default_error_mode'] = PEAR_ERROR_RETURN; |
@@ -451,9 +451,9 @@ discard block |
||
451 | 451 | // $error_code is a non-empty array here; |
452 | 452 | // we walk through it trying to unset all |
453 | 453 | // values |
454 | - foreach($error_code as $key => $error) { |
|
454 | + foreach ($error_code as $key => $error) { |
|
455 | 455 | if ($this->_checkDelExpect($error)) { |
456 | - $deleted = true; |
|
456 | + $deleted = true; |
|
457 | 457 | } else { |
458 | 458 | $deleted = false; |
459 | 459 | } |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | */ |
987 | 987 | function getMessage() |
988 | 988 | { |
989 | - return ($this->error_message_prefix . $this->message); |
|
989 | + return ($this->error_message_prefix.$this->message); |
|
990 | 990 | } |
991 | 991 | |
992 | 992 | |
@@ -1103,8 +1103,7 @@ discard block |
||
1103 | 1103 | if ($this->mode & PEAR_ERROR_CALLBACK) { |
1104 | 1104 | if (is_array($this->callback)) { |
1105 | 1105 | $callback = (is_object($this->callback[0]) ? |
1106 | - strtolower(get_class($this->callback[0])) : |
|
1107 | - $this->callback[0]) . '::' . |
|
1106 | + strtolower(get_class($this->callback[0])) : $this->callback[0]).'::'. |
|
1108 | 1107 | $this->callback[1]; |
1109 | 1108 | } else { |
1110 | 1109 | $callback = $this->callback; |