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 ( f7060e...00f73a )
by Brent
10s
created

SynchronousProcess::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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