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

eliashaeussler / composer-update-check / 20746954799

06 Jan 2026 11:29AM UTC coverage: 21.406%. First build
20746954799

Pull #130

github

web-flow
Merge pull request #213 from eliashaeussler/task/process
Pull Request #130: [!!!][FEATURE] Modernize plugin

385 of 1870 new or added lines in 57 files covered. (20.59%)

405 of 1892 relevant lines covered (21.41%)

1.18 hits per line

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

75.0
/src/Entity/Version.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of the Composer package "eliashaeussler/composer-update-check".
7
 *
8
 * Copyright (C) 2020-2026 Elias Häußler <elias@haeussler.dev>
9
 *
10
 * This program is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU General Public License as published by
12
 * the Free Software Foundation, either version 3 of the License, or
13
 * (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22
 */
23

24
namespace EliasHaeussler\ComposerUpdateCheck\Entity;
25

26
use Stringable;
27

28
use function sprintf;
29
use function substr;
30

31
/**
32
 * Version.
33
 *
34
 * @author Elias Häußler <elias@haeussler.dev>
35
 * @license GPL-3.0-or-later
36
 */
37
final readonly class Version implements Stringable
38
{
39
    public function __construct(
4✔
40
        private string $version,
41
        private ?string $sha1 = null,
42
    ) {}
4✔
43

NEW
44
    public function prettyVersion(): string
×
45
    {
NEW
46
        return $this->version;
×
47
    }
48

49
    public function sha1(bool $short = false): ?string
4✔
50
    {
51
        if (null === $this->sha1) {
4✔
52
            return null;
1✔
53
        }
54

55
        return $short ? substr($this->sha1, 0, 7) : $this->sha1;
3✔
56
    }
57

58
    public function toString(): string
1✔
59
    {
60
        $versionString = $this->version;
1✔
61
        $sha1 = $this->sha1(true);
1✔
62

63
        if ('' !== (string) $sha1) {
1✔
64
            $versionString .= sprintf(' (%s)', $sha1);
1✔
65
        }
66

67
        return $versionString;
1✔
68
    }
69

NEW
70
    public function __toString(): string
×
71
    {
NEW
72
        return $this->toString();
×
73
    }
74
}
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