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

leeqvip / php-apollo / 21219920138

21 Jan 2026 05:48PM UTC coverage: 52.607%. First build
21219920138

push

github

leeqvip
feat: first commit

111 of 211 new or added lines in 9 files covered. (52.61%)

111 of 211 relevant lines covered (52.61%)

6.17 hits per line

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

0.0
/src/Parsers/Parser.php
1
<?php
2

3
namespace Leeqvip\Apollo\Parsers;
4

5
class Parser
6
{
7
    public static function create(string $namespace): ParserInterface
8
    {
NEW
9
        $ext = self::getExt($namespace);
×
NEW
10
        return match ($ext) {
×
NEW
11
            'yml', 'yaml' => new YamlParser(),
×
NEW
12
            default => new DefaultParser(),
×
NEW
13
        };
×
14
    }
15

16
    protected static function getExt(string $namespace): string
17
    {
18
        // 获取后缀
NEW
19
        $parts = explode('.', ltrim($namespace, '.'));
×
20

21
        // 如果只有一个部分,说明没有后缀
NEW
22
        if (count($parts) <= 1) {
×
NEW
23
            return '';
×
24
        }
25

26
        // 获取最后一个部分作为后缀
NEW
27
        $ext = end($parts);
×
28

NEW
29
        return strtolower($ext);
×
30
    }
31
}
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