Code Duplication    Length = 41-41 lines in 2 locations

src/Reports/Code.php 1 location

@@ 257-297 (lines=41) @@
254
255
            echo str_repeat('-', $width).PHP_EOL;
256
257
            foreach ($lineErrors as $column => $colErrors) {
258
                foreach ($colErrors as $error) {
259
                    $padding = ($maxLineNumLength - strlen($line));
260
                    echo 'LINE '.str_repeat(' ', $padding).$line.': ';
261
262
                    if ($error['type'] === 'ERROR') {
263
                        echo "\033[31mERROR\033[0m";
264
                        if ($report['warnings'] > 0) {
265
                            echo '  ';
266
                        }
267
                    } else {
268
                        echo "\033[33mWARNING\033[0m";
269
                    }
270
271
                    echo ' ';
272
                    if ($report['fixable'] > 0) {
273
                        echo '[';
274
                        if ($error['fixable'] === true) {
275
                            echo 'x';
276
                        } else {
277
                            echo ' ';
278
                        }
279
280
                        echo '] ';
281
                    }
282
283
                    $message = $error['message'];
284
                    $message = str_replace("\n", "\n".$errorPadding, $message);
285
                    if ($showSources === true) {
286
                        $message = "\033[1m".$message."\033[0m".' ('.$error['source'].')';
287
                    }
288
289
                    $errorMsg = wordwrap(
290
                        $message,
291
                        $maxErrorSpace,
292
                        PHP_EOL.$errorPadding
293
                    );
294
295
                    echo $errorMsg.PHP_EOL;
296
                }//end foreach
297
            }//end foreach
298
299
            echo str_repeat('-', $width).PHP_EOL;
300
            echo rtrim($snippet).PHP_EOL;

src/Reports/Full.php 1 location

@@ 123-163 (lines=41) @@
120
        }
121
122
        foreach ($report['messages'] as $line => $lineErrors) {
123
            foreach ($lineErrors as $column => $colErrors) {
124
                foreach ($colErrors as $error) {
125
                    $message = $error['message'];
126
                    $message = str_replace("\n", "\n".$paddingLine2, $message);
127
                    if ($showSources === true) {
128
                        $message = "\033[1m".$message."\033[0m".' ('.$error['source'].')';
129
                    }
130
131
                    // The padding that goes on the front of the line.
132
                    $padding  = ($maxLineNumLength - strlen($line));
133
                    $errorMsg = wordwrap(
134
                        $message,
135
                        $maxErrorSpace,
136
                        PHP_EOL.$paddingLine2
137
                    );
138
139
                    echo ' '.str_repeat(' ', $padding).$line.' | ';
140
                    if ($error['type'] === 'ERROR') {
141
                        echo "\033[31mERROR\033[0m";
142
                        if ($report['warnings'] > 0) {
143
                            echo '  ';
144
                        }
145
                    } else {
146
                        echo "\033[33mWARNING\033[0m";
147
                    }
148
149
                    echo ' | ';
150
                    if ($report['fixable'] > 0) {
151
                        echo '[';
152
                        if ($error['fixable'] === true) {
153
                            echo 'x';
154
                        } else {
155
                            echo ' ';
156
                        }
157
158
                        echo '] ';
159
                    }
160
161
                    echo $errorMsg.PHP_EOL;
162
                }//end foreach
163
            }//end foreach
164
        }//end foreach
165
166
        echo str_repeat('-', $width).PHP_EOL;