• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

systemsdk / phpcpd / #4

30 Dec 2024 04:42PM UTC coverage: 75.789%. Remained the same
#4

push

DKravtsov
phpcpd 8.0.0 release. Made codebase refactoring. Updated requirements php 8.3, updated composer dependencies, updated tests to the PHPUnit 11. Updated dev environment to the php 8.4, Phing 3.0, added code quality tools: ecs, phpstan.

271 of 379 new or added lines in 20 files covered. (71.5%)

65 existing lines in 13 files now uncovered.

648 of 855 relevant lines covered (75.79%)

2.18 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Log/Text.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Systemsdk\PhpCPD\Log;
6

7
use Systemsdk\PhpCPD\CodeCloneMap;
8

9
use function count;
10
use function printf;
11

12
use const PHP_EOL;
13

14
final class Text
15
{
16
    public function printResult(CodeCloneMap $clones, bool $verbose): void
17
    {
NEW
18
        $countClones = count($clones);
×
19

NEW
20
        if ($countClones > 0) {
×
21
            printf(
×
22
                'Found %d code clones with %d duplicated lines in %d files:' . PHP_EOL . PHP_EOL,
×
NEW
23
                $countClones,
×
24
                $clones->numberOfDuplicatedLines(),
×
25
                $clones->numberOfFilesWithClones()
×
UNCOV
26
            );
×
27
        }
28

29
        foreach ($clones as $clone) {
×
UNCOV
30
            $firstOccurrence = true;
×
31

32
            foreach ($clone->files() as $file) {
×
33
                printf(
×
34
                    '  %s%s:%d-%d%s' . PHP_EOL,
×
35
                    $firstOccurrence ? '- ' : '  ',
×
36
                    $file->name(),
×
37
                    $file->startLine(),
×
38
                    $file->startLine() + $clone->numberOfLines(),
×
39
                    $firstOccurrence ? ' (' . $clone->numberOfLines() . ' lines)' : ''
×
UNCOV
40
                );
×
41

UNCOV
42
                $firstOccurrence = false;
×
43
            }
44

45
            if ($verbose) {
×
UNCOV
46
                print PHP_EOL . $clone->lines('    ');
×
47
            }
48

UNCOV
49
            print PHP_EOL;
×
50
        }
51

52
        if ($clones->isEmpty()) {
×
UNCOV
53
            print 'No code clones found.' . PHP_EOL . PHP_EOL;
×
54

UNCOV
55
            return;
×
56
        }
57

58
        printf(
×
59
            '%s duplicated lines out of %d total lines of code.' . PHP_EOL .
×
60
            'Average code clone size is %d lines, the largest code clone has %d lines' . PHP_EOL . PHP_EOL,
×
61
            $clones->percentage(),
×
62
            $clones->numberOfLines(),
×
63
            $clones->averageSize(),
×
64
            $clones->largestSize()
×
UNCOV
65
        );
×
66
    }
67
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc