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.
Passed
Pull Request — master (#1)
by Pascal
02:42
created

ServiceResourceBuilder::build()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Saikootau\ApiBundle\Resource\Builder;
6
7
use Saikootau\ApiBundle\Resource\Error;
8
use Saikootau\ApiBundle\Resource\Service;
9
use Symfony\Component\HttpFoundation\Request;
10
11
class ServiceResourceBuilder
12
{
13
    private $request;
14
    private $errors = [];
15
16 10
    public function __construct(Request $request)
17
    {
18 10
        $this->request = $request;
19 10
    }
20
21
    /**
22
     * Add errors to the stack.
23
     *
24
     * @param Error ...$errors
25
     *
26
     * @return ServiceResourceBuilder
27
     */
28 9
    public function addError(Error ...$errors): self
29
    {
30 9
        $this->errors = array_merge($this->errors, $errors);
31
32 9
        return $this;
33
    }
34
35 10
    public function build(): Service
36
    {
37 10
        $requestResource = (new RequestResourceBuilder())->build($this->request);
38
39 10
        return new Service($requestResource, ...$this->errors);
40
    }
41
}
42