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 ( 9adf99...efb5ce )
by Cees-Jan
03:54
created

functions.php ➔ childProcessPromise()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 14
nc 1
nop 2
dl 0
loc 24
ccs 13
cts 13
cp 1
crap 1
rs 8.9713
c 0
b 0
f 0
1
<?php
2
3
namespace WyriHaximus\React;
4
5
use React\ChildProcess\Process;
6
use React\EventLoop\LoopInterface;
7
use React\Promise\Deferred;
8
9
/**
10
 * Promise that resolves once child process exits
11
 *
12
 * @param LoopInterface $loop    ReactPHP event loop.
13
 * @param Process       $process Child Process to run.
14
 *
15
 * @return \React\Promise\PromiseInterface
16
 */
17
function childProcessPromise(LoopInterface $loop, Process $process)
18
{
19 1
    $deferred = new Deferred();
20
    $buffers = [
21 1
        'stderr' => '',
22 1
        'stdout' => '',
23 1
    ];
24
25
    $process->on('exit', function ($exitCode) use ($deferred, &$buffers) {
26 1
        $deferred->resolve(new ProcessOutcome($exitCode, $buffers['stderr'], $buffers['stdout']));
27 1
    });
28
29
    \WyriHaximus\React\futurePromise($loop, $process)->then(function (Process $process) use ($loop, &$buffers) {
30 1
        $process->start($loop);
31
        $process->stderr->on('data', function ($output) use (&$buffers) {
32 1
            $buffers['stderr'] .= $output;
33 1
        });
34
        $process->stdout->on('data', function ($output) use (&$buffers) {
35 1
            $buffers['stdout'] .= $output;
36 1
        });
37 1
    });
38
39 1
    return $deferred->promise();
40
}
41