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

68publishers / file-storage / 15323772123

29 May 2025 12:24PM UTC coverage: 89.828% (-2.5%) from 92.308%
15323772123

Pull #8

github

web-flow
Merge 2702b3045 into da640973d
Pull Request #8: PHP 8.4 support

574 of 639 relevant lines covered (89.83%)

0.9 hits per line

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

90.91
/src/Helper/Path.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace SixtyEightPublishers\FileStorage\Helper;
6

7
use function array_pop;
8
use function count;
9
use function explode;
10
use function implode;
11
use function trim;
12

13
final class Path
14
{
15
    private function __construct() {}
×
16

17
    /**
18
     * 0 => (string) namespace
19
     * 1 => (string) name
20
     * 2 => (?string) extension
21
     *
22
     * @return array{0: string, 1: string, 2: ?string}
23
     */
24
    public static function parse(string $path): array
25
    {
26
        $namespace = explode('/', trim($path, " \t\n\r\0\x0B/"));
1✔
27
        $name = explode('.', array_pop($namespace));
1✔
28
        $startsWithDot = false;
1✔
29

30
        if (1 < count($name) && '' === ($name[0] ?? null)) {
1✔
31
            unset($name[0]);
1✔
32
            $startsWithDot = true;
1✔
33
        }
34

35
        $extension = 1 < count($name) ? array_pop($name) : null;
1✔
36

37
        return [
38
            implode('/', $namespace),
1✔
39
            ($startsWithDot ? '.' : '') . implode('.', $name),
1✔
40
            $extension,
1✔
41
        ];
42
    }
43
}
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