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   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 15
c 2
b 0
f 0
dl 0
loc 42
ccs 17
cts 17
cp 1
rs 10
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A isStillRunning() 0 3 1
A killProcess() 0 3 1
A startProcess() 0 29 3
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