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
Pull Request — master (#111)
by Alexander
01:48 queued 34s
created

SynchronousProcess::withBinary()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Spatie\Async\Process;
4
5
use Spatie\Async\Pool;
6
use Spatie\Async\Task;
7
use Throwable;
8
9
class SynchronousProcess implements Runnable
10
{
11
    protected $id;
12
13
    protected $task;
14
15
    protected $output;
16
    protected $errorOutput;
17
    protected $executionTime;
18
19
    use ProcessCallbacks;
20
21
    public function __construct(callable $task, int $id)
22
    {
23
        $this->id = $id;
24
        $this->task = $task;
25
    }
26
27
    public static function create(callable $task, int $id): self
28
    {
29
        return new self($task, $id);
30
    }
31
32
    public function getId(): int
33
    {
34
        return $this->id;
35
    }
36
37
    public function getPid(): ?int
38
    {
39
        return $this->getId();
40
    }
41
42
    public function start()
43
    {
44
        $startTime = microtime(true);
45
46
        try {
47
            $this->output = $this->task instanceof Task
48
                ? $this->task->run()
49
                : call_user_func($this->task);
50
        } catch (Throwable $throwable) {
51
            $this->errorOutput = $throwable;
52
        } finally {
53
            $this->executionTime = microtime(true) - $startTime;
54
        }
55
    }
56
57
    public function stop()
58
    {
59
    }
60
61
    public function getOutput()
62
    {
63
        return $this->output;
64
    }
65
66
    public function getErrorOutput()
67
    {
68
        return $this->errorOutput;
69
    }
70
71
    public function getCurrentExecutionTime(): float
72
    {
73
        return $this->executionTime;
74
    }
75
76
    protected function resolveErrorOutput(): Throwable
77
    {
78
        return $this->getErrorOutput();
79
    }
80
81
    public function withBinary(string $binary = Pool::DEFAULT_PHP_BINARY): self
82
    {
83
        return $this;
84
    }
85
}
86