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

orchestral / sidekick / 20615081164

31 Dec 2025 08:15AM UTC coverage: 91.549% (-0.4%) from 91.943%
20615081164

Pull #60

github

web-flow
Merge 0c92a4790 into 79e87f3f5
Pull Request #60: [1.2.x] Move `is_symlink()` and `join_paths()` to `Orchestra\Sidekick\Filesystem` namespace

9 of 12 new or added lines in 2 files covered. (75.0%)

195 of 213 relevant lines covered (91.55%)

6.48 hits per line

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

82.35
/src/Filesystem/functions.php
1
<?php
2

3
namespace Orchestra\Sidekick\Filesystem;
4

5
use ReflectionClass;
6

7
if (! \function_exists('Orchestra\Sidekick\Filesystem\filename_from_classname')) {
8
    /**
9
     * Resolve filename from classname.
10
     *
11
     * @api
12
     *
13
     * @param  class-string  $className
14
     */
15
    function filename_from_classname(string $className): string|false
16
    {
17
        if (! class_exists($className, false)) {
1✔
18
            return false;
1✔
19
        }
20

21
        $classFileName = (new ReflectionClass($className))->getFileName();
1✔
22

23
        if (
24
            $classFileName === false
1✔
25
            || (! is_file($classFileName) && ! str_ends_with(strtolower($classFileName), '.php'))
1✔
26
        ) {
27
            return false;
×
28
        }
29

30
        return realpath($classFileName);
1✔
31
    }
32
}
33

34
if (! \function_exists('Orchestra\Sidekick\Filesystem\is_symlink')) {
35
    /**
36
     * Determine if the path is a symlink for both Unix and Windows environments.
37
     *
38
     * @api
39
     */
40
    function is_symlink(string $path): bool
41
    {
42
        if (\Orchestra\Sidekick\windows_os() && is_dir($path) && readlink($path) !== $path) {
1✔
NEW
43
            return true;
×
44
        } elseif (is_link($path)) {
1✔
NEW
45
            return true;
×
46
        }
47

48
        return false;
1✔
49
    }
50
}
51

52
if (! \function_exists('Orchestra\Sidekick\Filesystem\join_paths')) {
53
    /**
54
     * Join the given paths together.
55
     *
56
     * @api
57
     */
58
    function join_paths(?string $basePath, string ...$paths): string
59
    {
60
        foreach ($paths as $index => $path) {
21✔
61
            if (empty($path) && $path !== '0') {
21✔
62
                unset($paths[$index]);
20✔
63
            } else {
64
                $paths[$index] = DIRECTORY_SEPARATOR.ltrim($path, DIRECTORY_SEPARATOR);
21✔
65
            }
66
        }
67

68
        return $basePath.implode('', $paths);
21✔
69
    }
70
}
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