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

PHP-CS-Fixer / PHP-CS-Fixer / 7167185944

11 Dec 2023 12:08PM UTC coverage: 94.908%. Remained the same
7167185944

push

github

web-flow
fix: Better OS detection in integration tests (#7547)

24900 of 26236 relevant lines covered (94.91%)

41.63 hits per line

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

0.0
/src/Console/SelfUpdate/GithubClient.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of PHP CS Fixer.
7
 *
8
 * (c) Fabien Potencier <fabien@symfony.com>
9
 *     Dariusz RumiƄski <dariusz.ruminski@gmail.com>
10
 *
11
 * This source file is subject to the MIT license that is bundled
12
 * with this source code in the file LICENSE.
13
 */
14

15
namespace PhpCsFixer\Console\SelfUpdate;
16

17
/**
18
 * @internal
19
 */
20
final class GithubClient implements GithubClientInterface
21
{
22
    public function getTags(): array
23
    {
24
        $url = 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tags';
×
25

26
        $result = @file_get_contents(
×
27
            $url,
×
28
            false,
×
29
            stream_context_create([
×
30
                'http' => [
×
31
                    'header' => 'User-Agent: PHP-CS-Fixer/PHP-CS-Fixer',
×
32
                ],
×
33
            ])
×
34
        );
×
35

36
        if (false === $result) {
×
37
            throw new \RuntimeException(sprintf('Failed to load tags at "%s".', $url));
×
38
        }
39

40
        $result = json_decode($result, true);
×
41
        if (JSON_ERROR_NONE !== json_last_error()) {
×
42
            throw new \RuntimeException(sprintf(
×
43
                'Failed to read response from "%s" as JSON: %s.',
×
44
                $url,
×
45
                json_last_error_msg()
×
46
            ));
×
47
        }
48

49
        return $result;
×
50
    }
51
}
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