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

eliashaeussler / version-bumper / 12018245905

25 Nov 2024 08:28PM UTC coverage: 88.745%. Remained the same
12018245905

push

github

eliashaeussler
[TASK] Disable tests with PHP 8.4 and Composer 2.2/2.3

615 of 693 relevant lines covered (88.74%)

4.11 hits per line

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

77.78
/src/Config/FileToModify.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of the Composer package "eliashaeussler/version-bumper".
7
 *
8
 * Copyright (C) 2024 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\VersionBumper\Config;
25

26
use EliasHaeussler\VersionBumper\Exception;
27
use Symfony\Component\Filesystem;
28

29
use function is_string;
30

31
/**
32
 * FileToModify.
33
 *
34
 * @author Elias Häußler <elias@haeussler.dev>
35
 * @license GPL-3.0-or-later
36
 */
37
final class FileToModify
38
{
39
    /**
40
     * @var list<FilePattern>
41
     */
42
    private array $patterns = [];
43

44
    /**
45
     * @param list<string|FilePattern> $patterns
46
     *
47
     * @throws Exception\FilePatternIsInvalid
48
     */
49
    public function __construct(
5✔
50
        private readonly string $path,
51
        array $patterns = [],
52
        private readonly bool $reportUnmatched = false,
53
    ) {
54
        foreach ($patterns as $pattern) {
5✔
55
            $this->add($pattern);
1✔
56
        }
57
    }
58

59
    public function path(): string
×
60
    {
61
        return $this->path;
×
62
    }
63

64
    public function fullPath(string $rootPath): string
2✔
65
    {
66
        if (Filesystem\Path::isAbsolute($this->path)) {
2✔
67
            return $this->path;
1✔
68
        }
69

70
        return Filesystem\Path::join($rootPath, $this->path);
1✔
71
    }
72

73
    /**
74
     * @return list<FilePattern>
75
     */
76
    public function patterns(): array
3✔
77
    {
78
        return $this->patterns;
3✔
79
    }
80

81
    /**
82
     * @throws Exception\FilePatternIsInvalid
83
     */
84
    public function add(string|FilePattern $pattern): self
3✔
85
    {
86
        if (is_string($pattern)) {
3✔
87
            $pattern = new FilePattern($pattern);
2✔
88
        }
89

90
        $this->patterns[] = $pattern;
3✔
91

92
        return $this;
3✔
93
    }
94

95
    public function reportUnmatched(): bool
×
96
    {
97
        return $this->reportUnmatched;
×
98
    }
99
}
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

© 2025 Coveralls, Inc