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

systemsdk / phpcpd / #24

18 May 2025 05:01PM UTC coverage: 75.818% (-0.7%) from 76.552%
#24

push

DKravtsov
phpcpd 8.2.2 release. Improved progress bar.

9 of 34 new or added lines in 3 files covered. (26.47%)

718 of 947 relevant lines covered (75.82%)

3.61 hits per line

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

0.0
/src/Detector/Traits/ProgressBarTrait.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Systemsdk\PhpCPD\Detector\Traits;
6

7
use function sprintf;
8

9
trait ProgressBarTrait
10
{
11
    private function progressBar(int $done, int $total, string $title = '', int $width = 30): void
12
    {
NEW
13
        $perc = $this->countProgressBarPercent($done, $total);
×
NEW
14
        $bar = (int)floor(($width * $perc) / 100);
×
NEW
15
        print sprintf(
×
NEW
16
            " %s/%s [%s>%s] %s%% %s\r",
×
NEW
17
            $done,
×
NEW
18
            $total,
×
NEW
19
            str_repeat('=', $bar),
×
NEW
20
            str_repeat(' ', $width - $bar),
×
NEW
21
            $perc,
×
NEW
22
            $title
×
NEW
23
        );
×
24

NEW
25
        if ($done >= $total) {
×
NEW
26
            print PHP_EOL;
×
27
        }
28
    }
29

30
    private function countProgressBarPercent(int $done, int $total): int
31
    {
NEW
32
        return (int)floor(($done * 100) / $total);
×
33
    }
34
}
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