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

MikeGeorgeff / kernel / 30386301394

28 Jul 2026 06:11PM UTC coverage: 99.66%. First build
30386301394

Pull #7

github

web-flow
Merge 030686980 into 85251cece
Pull Request #7: 2.x

406 of 408 new or added lines in 24 files covered. (99.51%)

587 of 589 relevant lines covered (99.66%)

35.37 hits per line

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

96.15
/src/Profiler/Profile.php
1
<?php
2

3
namespace Georgeff\Kernel\Profiler;
4

5
use Georgeff\Kernel\Contract\DebuggableInterface;
6

7
/**
8
 * @internal
9
 */
10
final class Profile implements DebuggableInterface
11
{
12
    private readonly Phase $timer;
13

14
    /**
15
     * Phase timer
16
     *
17
     * @var array<string, Phase>
18
     */
19
    private array $phases = [];
20

21
    public function __construct(private readonly string $name)
22
    {
23
        $this->timer = new Phase('__profile__');
49✔
24
    }
25

26
    public function getName(): string
27
    {
28
        return $this->name;
1✔
29
    }
30

31
    public function isIncomplete(): bool
32
    {
NEW
33
        return $this->timer->isIncomplete();
×
34
    }
35

36
    public function start(): float
37
    {
38
        return $this->timer->start();
35✔
39
    }
40

41
    public function stop(): float
42
    {
43
        return $this->timer->stop();
21✔
44
    }
45

46
    public function getStartTime(): ?float
47
    {
48
        return $this->timer->getStartTime();
27✔
49
    }
50

51
    public function getEndTime(): ?float
52
    {
53
        return $this->timer->getEndTime();
25✔
54
    }
55

56
    public function hasPhase(string $phase): bool
57
    {
58
        return isset($this->phases[$phase]);
26✔
59
    }
60

61
    public function startPhase(string $phase): float
62
    {
63
        $this->phases[$phase] = new Phase($phase);
24✔
64

65
        return $this->phases[$phase]->start();
24✔
66
    }
67

68
    public function stopPhase(string $phase): float
69
    {
70
        if (!$this->hasPhase($phase)) {
22✔
71
            $this->phases[$phase] = new Phase($phase);
1✔
72
        }
73

74
        return $this->phases[$phase]->stop();
22✔
75
    }
76

77
    public function getPhaseDuration(string $phase): ?float
78
    {
79
        return $this->hasPhase($phase)
5✔
80
            ? $this->phases[$phase]->getDuration()
4✔
81
            : null;
5✔
82
    }
83

84
    public function getOverallDuration(): ?float
85
    {
86
        return $this->timer->getDuration();
26✔
87
    }
88

89
    public function getDebugInfo(): array
90
    {
91
        $info = [
23✔
92
            'start.time'   => $this->getStartTime(),
23✔
93
            'end.time'     => $this->getEndTime(),
23✔
94
            'duration'     => $this->getOverallDuration(),
23✔
95
            'memory.usage' => $this->timer->getMemoryUsage(),
23✔
96
        ];
23✔
97

98
        foreach ($this->phases as $phase) {
23✔
99
            $info['phases'][$phase->getName()] = $phase->getDebugInfo();
17✔
100
        }
101

102
        return $info;
23✔
103
    }
104
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc