Skip to content

Commit d3dcb28

Browse files
committed
Merge branch 'code-cleaning'
2 parents 09d0c4c + c81931f commit d3dcb28

File tree

3 files changed

+42
-42
lines changed

3 files changed

+42
-42
lines changed

lib/Diff/Renderer/Text/Context.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,31 @@
55
* PHP version 5
66
*
77
* Copyright (c) 2009 Chris Boulton <chris.boulton@interspire.com>
8-
*
8+
*
99
* All rights reserved.
10-
*
11-
* Redistribution and use in source and binary forms, with or without
10+
*
11+
* Redistribution and use in source and binary forms, with or without
1212
* modification, are permitted provided that the following conditions are met:
1313
*
1414
* - Redistributions of source code must retain the above copyright notice,
1515
* this list of conditions and the following disclaimer.
1616
* - Redistributions in binary form must reproduce the above copyright notice,
1717
* this list of conditions and the following disclaimer in the documentation
1818
* and/or other materials provided with the distribution.
19-
* - Neither the name of the Chris Boulton nor the names of its contributors
20-
* may be used to endorse or promote products derived from this software
19+
* - Neither the name of the Chris Boulton nor the names of its contributors
20+
* may be used to endorse or promote products derived from this software
2121
* without specific prior written permission.
2222
*
23-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24-
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26-
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27-
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28-
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29-
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30-
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31-
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32-
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3333
* POSSIBILITY OF SUCH DAMAGE.
3434
*
3535
* @package DiffLib
@@ -66,13 +66,13 @@ public function render()
6666
foreach($opCodes as $group) {
6767
$diff .= "***************\n";
6868
$lastItem = count($group)-1;
69-
$i1 = $group[0][1];
70-
$i2 = $group[$lastItem][2];
71-
$j1 = $group[0][3];
72-
$j2 = $group[$lastItem][4];
69+
$i1 = $group['0']['1'];
70+
$i2 = $group[$lastItem]['2'];
71+
$j1 = $group['0']['3'];
72+
$j2 = $group[$lastItem]['4'];
7373

7474
if($i2 - $i1 >= 2) {
75-
$diff .= '*** '.($group[0][1] + 1).','.$i2." ****\n";
75+
$diff .= '*** '.($group['0']['1'] + 1).','.$i2." ****\n";
7676
}
7777
else {
7878
$diff .= '*** '.$i2." ****\n";
@@ -87,7 +87,7 @@ public function render()
8787

8888
$hasVisible = false;
8989
foreach($group as $code) {
90-
if($code[0] == 'replace' || $code[0] == 'delete') {
90+
if($code['0'] == 'replace' || $code['0'] == 'delete') {
9191
$hasVisible = true;
9292
break;
9393
}
@@ -105,7 +105,7 @@ public function render()
105105

106106
$hasVisible = false;
107107
foreach($group as $code) {
108-
if($code[0] == 'replace' || $code[0] == 'insert') {
108+
if($code['0'] == 'replace' || $code['0'] == 'insert') {
109109
$hasVisible = true;
110110
break;
111111
}

lib/Diff/Renderer/Text/Unified.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,31 @@
55
* PHP version 5
66
*
77
* Copyright (c) 2009 Chris Boulton <chris.boulton@interspire.com>
8-
*
8+
*
99
* All rights reserved.
10-
*
11-
* Redistribution and use in source and binary forms, with or without
10+
*
11+
* Redistribution and use in source and binary forms, with or without
1212
* modification, are permitted provided that the following conditions are met:
1313
*
1414
* - Redistributions of source code must retain the above copyright notice,
1515
* this list of conditions and the following disclaimer.
1616
* - Redistributions in binary form must reproduce the above copyright notice,
1717
* this list of conditions and the following disclaimer in the documentation
1818
* and/or other materials provided with the distribution.
19-
* - Neither the name of the Chris Boulton nor the names of its contributors
20-
* may be used to endorse or promote products derived from this software
19+
* - Neither the name of the Chris Boulton nor the names of its contributors
20+
* may be used to endorse or promote products derived from this software
2121
* without specific prior written permission.
2222
*
23-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24-
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26-
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27-
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28-
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29-
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30-
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31-
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32-
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3333
* POSSIBILITY OF SUCH DAMAGE.
3434
*
3535
* @package DiffLib
@@ -55,10 +55,10 @@ public function render()
5555
$opCodes = $this->diff->getGroupedOpcodes();
5656
foreach($opCodes as $group) {
5757
$lastItem = count($group)-1;
58-
$i1 = $group[0][1];
59-
$i2 = $group[$lastItem][2];
60-
$j1 = $group[0][3];
61-
$j2 = $group[$lastItem][4];
58+
$i1 = $group['0']['1'];
59+
$i2 = $group[$lastItem]['2'];
60+
$j1 = $group['0']['3'];
61+
$j2 = $group[$lastItem]['4'];
6262

6363
if($i1 == 0 && $i2 == 0) {
6464
$i1 = -1;

lib/Diff/SequenceMatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ public function getGroupedOpcodes($context=3)
544544
}
545545

546546
$lastItem = count($opCodes) - 1;
547-
if($opCodes[$lastItem][0] == 'equal') {
547+
if($opCodes[$lastItem]['0'] == 'equal') {
548548
list($tag, $i1, $i2, $j1, $j2) = $opCodes[$lastItem];
549549
$opCodes[$lastItem] = array(
550550
$tag,

0 commit comments

Comments
 (0)