![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/sebastian/phpcpd/src/Log/ |
<?php declare(strict_types=1); /* * This file is part of PHP Copy/Paste Detector (PHPCPD). * * (c) Sebastian Bergmann <[email protected]> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace SebastianBergmann\PHPCPD\Log; use const PHP_EOL; use function count; use function printf; use SebastianBergmann\PHPCPD\CodeCloneMap; final class Text { public function printResult(CodeCloneMap $clones, bool $verbose): void { if (count($clones) > 0) { printf( 'Found %d clones with %d duplicated lines in %d files:' . PHP_EOL . PHP_EOL, count($clones), $clones->numberOfDuplicatedLines(), $clones->numberOfFilesWithClones() ); } foreach ($clones as $clone) { $firstOccurrence = true; foreach ($clone->files() as $file) { printf( ' %s%s:%d-%d%s' . PHP_EOL, $firstOccurrence ? '- ' : ' ', $file->name(), $file->startLine(), $file->startLine() + $clone->numberOfLines(), $firstOccurrence ? ' (' . $clone->numberOfLines() . ' lines)' : '' ); $firstOccurrence = false; } if ($verbose) { print PHP_EOL . $clone->lines(' '); } print PHP_EOL; } if ($clones->isEmpty()) { print 'No clones found.' . PHP_EOL . PHP_EOL; return; } printf( '%s duplicated lines out of %d total lines of code.' . PHP_EOL . 'Average size of duplication is %d lines, largest clone has %d of lines' . PHP_EOL . PHP_EOL, $clones->percentage(), $clones->numberOfLines(), $clones->averageSize(), $clones->largestSize() ); } }