• 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

84.62
/src/CodeCloneMapIterator.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Systemsdk\PhpCPD;
6

7
use Iterator;
8

9
use function array_reverse;
10
use function count;
11
use function usort;
12

13
final class CodeCloneMapIterator implements Iterator
14
{
15
    /**
16
     * @var array<int, CodeClone>
17
     */
18
    private array $clones;
19

20
    private int $position = 0;
21

22
    public function __construct(CodeCloneMap $clones)
23
    {
24
        $this->clones = $clones->clones();
1✔
25

26
        usort(
1✔
27
            $this->clones,
1✔
28
            static function (CodeClone $a, CodeClone $b): int {
1✔
UNCOV
29
                return $a->numberOfLines() <=> $b->numberOfLines();
×
30
            }
1✔
31
        );
1✔
32

33
        $this->clones = array_reverse($this->clones);
1✔
34
    }
35

36
    public function rewind(): void
37
    {
38
        $this->position = 0;
1✔
39
    }
40

41
    public function valid(): bool
42
    {
43
        return $this->position < count($this->clones);
1✔
44
    }
45

46
    public function key(): int
47
    {
UNCOV
48
        return $this->position;
×
49
    }
50

51
    public function current(): CodeClone
52
    {
53
        return $this->clones[$this->position];
1✔
54
    }
55

56
    public function next(): void
57
    {
58
        $this->position++;
1✔
59
    }
60
}
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