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

azjezz / psl / 23168991161

16 Mar 2026 10:30PM UTC coverage: 99.3% (-0.05%) from 99.347%
23168991161

push

github

web-flow
chore: remove internal circular dependencies, and reduce inter-dependencies (#648)

380 of 385 new or added lines in 157 files covered. (98.7%)

1 existing line in 1 file now uncovered.

10775 of 10851 relevant lines covered (99.3%)

37.35 hits per line

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

66.67
/src/Psl/Filesystem/copy.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Psl\Filesystem;
6

7
use function sprintf;
8

9
/**
10
 * Copy a file from $source to $destination and preserve executable permission bits.
11
 *
12
 * @param non-empty-string $source
13
 * @param non-empty-string $destination
14
 *
15
 * @throws Exception\RuntimeException If unable to copy $source to $destination.
16
 * @throws Exception\NotFoundException If $source is not found.
17
 * @throws Exception\NotReadableException If $source is not readable.
18
 */
19
function copy(string $source, string $destination, bool $overwrite = false): void
20
{
21
    $destinationExists = namespace\is_file($destination);
5✔
22
    if (!$overwrite && $destinationExists) {
5✔
23
        return;
1✔
24
    }
25

26
    if (!namespace\is_file($source)) {
5✔
27
        throw Exception\NotFoundException::forFile($source);
1✔
28
    }
29

30
    if (!namespace\is_readable($source)) {
4✔
31
        throw Exception\NotReadableException::forFile($source);
1✔
32
    }
33

34
    $result = \copy($source, $destination);
3✔
35
    if (!$result) {
3✔
NEW
36
        throw new Exception\RuntimeException(sprintf(
×
NEW
37
            'Failed to copy source file "%s" to destination "%s".',
×
NEW
38
            $source,
×
UNCOV
39
            $destination,
×
NEW
40
        ));
×
41
    }
42

43
    // preserve executable permission bits
44
    change_permissions($destination, get_permissions($destination) | (get_permissions($source) & 0o111));
3✔
45
}
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