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.
Completed
Push — master ( 0f9f95...51b644 )
by
unknown
03:15
created

Reporter::report()   C

Complexity

Conditions 7
Paths 10

Size

Total Lines 27
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 7
eloc 15
nc 10
nop 1
dl 0
loc 27
rs 6.7272
c 0
b 0
f 0
1
<?php
2
/* (c) Anton Medvedev <[email protected]>
3
 *
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 */
7
8
namespace Deployer\Utility;
9
10
/**
11
 * @codeCoverageIgnore
12
 */
13
class Reporter
14
{
15
    const ENDPOINT = 'https://deployer.org/api/stats';
16
17
    /**
18
     * @param array $stats
19
     */
20
    public static function report(array $stats)
21
    {
22
        $pid = null;
23
        if (extension_loaded('pcntl')) {
24
            declare(ticks = 1);
25
            $pid = pcntl_fork();
26
        }
27
28
        if (is_null($pid) || $pid === -1) {
29
            // Fork fails or there is no `pcntl` extension.
30
            try {
31
                Request::post(self::ENDPOINT, $stats);
32
            } catch (\Throwable $e) {
33
                // pass
34
            }
35
        } elseif ($pid === 0) {
36
            // Child process.
37
            posix_setsid();
38
            try {
39
                Request::post(self::ENDPOINT, $stats);
40
            } catch (\Throwable $e) {
41
                // pass
42
            }
43
            // Close child process after doing job.
44
            exit(0);
45
        }
46
    }
47
}
48