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.

ProcessManager::isStillRunning()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Webparking\QueueEnsurer\Processes;
4
5
class ProcessManager
6
{
7 4
    public function isStillRunning(int $processId): bool
8
    {
9 4
        return posix_kill($processId, 0);
10
    }
11
12 3
    public function startProcess(
13
        string $phpPath,
14
        string $queueName,
15
        ?string $connection,
16
        bool $specifyQueue,
17
        int $timeout,
18
        int $sleep,
19
        int $tries
20
    ): int {
21 3
        $command = $phpPath;
22 3
        $command .= ' artisan queue:work';
23
24 3
        if (null !== $connection) {
25 1
            $command .= ' ' . $connection;
26
        }
27
28 3
        if ($specifyQueue) {
29 3
            $command .= ' --queue ' . $queueName;
30
        }
31
32 3
        $command .= ' --timeout ' . $timeout;
33 3
        $command .= ' --sleep ' . $sleep;
34 3
        $command .= ' --tries ' . $tries;
35
36
        // Suppress output and return PID
37 3
        $command .= ' > /dev/null & echo $!';
38
39 3
        return (int) exec(
40 3
            $command
41
        );
42
    }
43
44 2
    public function killProcess(int $processId): void
45
    {
46 2
        posix_kill($processId, 9);
47 2
    }
48
}
49