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   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 35
rs 10
c 0
b 0
f 0
wmc 7
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
C report() 0 27 7
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