Code Duplication    Length = 17-17 lines in 3 locations

htdocs/class/libraries/vendor/smottt/wideimage/lib/WideImage/Operation/AutoCrop.php 3 locations

@@ 87-103 (lines=17) @@
84
			}
85
		}
86
		
87
		for ($y = $img->getHeight() - 1; $y >= $cut_rect['top']; $y--) {
88
			$count = 0;
89
			
90
			for ($x = 0; $x <= $cut_rect['right']; $x++) {
91
				$rgb  = $img->getRGBAt($x, $y);
92
				$diff = abs($rgb['red'] - $rgb_base['red']) + abs($rgb['green'] - $rgb_base['green']) + abs($rgb['blue'] - $rgb_base['blue']);
93
				
94
				if ($diff > $rgb_threshold) {
95
					$count++;
96
					
97
					if ($count >= $pixel_cutoff) {
98
						$cut_rect['bottom'] = $y;
99
						break 2;
100
					}
101
				}
102
			}
103
		}
104
		
105
		for ($x = 0; $x <= $cut_rect['right']; $x++) {
106
			$count = 0;
@@ 105-121 (lines=17) @@
102
			}
103
		}
104
		
105
		for ($x = 0; $x <= $cut_rect['right']; $x++) {
106
			$count = 0;
107
			
108
			for ($y = $cut_rect['top']; $y <= $cut_rect['bottom']; $y++) {
109
				$rgb  = $img->getRGBAt($x, $y);
110
				$diff = abs($rgb['red'] - $rgb_base['red']) + abs($rgb['green'] - $rgb_base['green']) + abs($rgb['blue'] - $rgb_base['blue']);
111
				
112
				if ($diff > $rgb_threshold) {
113
					$count++;
114
					
115
					if ($count >= $pixel_cutoff) {
116
						$cut_rect['left'] = $x;
117
						break 2;
118
					}
119
				}
120
			}
121
		}
122
		
123
		for ($x = $cut_rect['right']; $x >= $cut_rect['left']; $x--) {
124
			$count = 0;
@@ 123-139 (lines=17) @@
120
			}
121
		}
122
		
123
		for ($x = $cut_rect['right']; $x >= $cut_rect['left']; $x--) {
124
			$count = 0;
125
			
126
			for ($y = $cut_rect['top']; $y <= $cut_rect['bottom']; $y++) {
127
				$rgb  = $img->getRGBAt($x, $y);
128
				$diff = abs($rgb['red'] - $rgb_base['red']) + abs($rgb['green'] - $rgb_base['green']) + abs($rgb['blue'] - $rgb_base['blue']);
129
				
130
				if ($diff > $rgb_threshold) {
131
					$count++;
132
					
133
					if ($count >= $pixel_cutoff) {
134
						$cut_rect['right'] = $x;
135
						break 2;
136
					}
137
				}
138
			}
139
		}
140
		
141
		$cut_rect = array(
142
			'left'   => $cut_rect['left'] - $margin,