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 ( 2809db...84b5a3 )
by Brent
01:29
created

ErrorProcessOutput::payload()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
namespace Spatie\Async\Output;
4
5
use Throwable;
6
use InvalidArgumentException;
7
8
// TODO: Move to separate namespace
9
class ErrorProcessOutput extends ProcessOutput
10
{
11
    /**
12
     * @param $payload
13
     *
14
     * @return static
15
     */
16
    public static function create($payload)
17
    {
18
        if (! $payload instanceof Throwable) {
19
            throw new InvalidArgumentException('ErrorProcessOutput only accepts Throwables.');
20
        }
21
22
        $payload = [
23
            'class' => get_class($payload),
24
            'message' => $payload->getMessage(),
25
        ];
26
27
        return new static($payload);
28
    }
29
30
    public function payload(): Throwable
31
    {
32
        $class = $this->payload['class'] ?? null;
33
        $message = $this->payload['message'] ?? null;
34
35
        $payload = new $class($message);
36
37
        return $payload;
38
    }
39
}
40