GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Reporter::report()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 25
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 11
nc 1
nop 1
dl 0
loc 25
c 0
b 0
f 0
cc 1
rs 9.9
1
<?php
2
3
declare(strict_types=1);
4
5
/* (c) Anton Medvedev <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Deployer\Support;
12
13
use Deployer\Utility\Httpie;
14
use Symfony\Component\Process\PhpProcess;
15
16
/**
17
 * @codeCoverageIgnore
18
 */
19
class Reporter
20
{
21
    public static function report(array $stats): void
22
    {
23
        $version = DEPLOYER_VERSION;
0 ignored issues
show
Bug introduced by
The constant Deployer\Support\DEPLOYER_VERSION was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
24
        $body = json_encode($stats);
25
        $length = strlen($body);
26
        $php = new PhpProcess(<<<EOF
27
            <?php
28
            \$ch = curl_init('https://deployer.org/api/stats');
29
            curl_setopt(\$ch, CURLOPT_USERAGENT, 'Deployer/$version');
30
            curl_setopt(\$ch, CURLOPT_CUSTOMREQUEST, 'POST');
31
            curl_setopt(\$ch, CURLOPT_HTTPHEADER, [
32
                'Content-Type: application/json',
33
                'Content-Length: $length',
34
            ]);
35
            curl_setopt(\$ch, CURLOPT_POSTFIELDS, '$body');
36
            curl_setopt(\$ch, CURLOPT_SSL_VERIFYPEER, false);
37
            curl_setopt(\$ch, CURLOPT_RETURNTRANSFER, true);
38
            curl_setopt(\$ch, CURLOPT_FOLLOWLOCATION, true);
39
            curl_setopt(\$ch, CURLOPT_MAXREDIRS, 10);
40
            curl_setopt(\$ch, CURLOPT_CONNECTTIMEOUT, 5);
41
            curl_setopt(\$ch, CURLOPT_TIMEOUT, 5);
42
            \$result = curl_exec(\$ch);
43
            curl_close(\$ch);
44
            EOF);
45
        $php->start();
46
    }
47
}
48