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 (#1)
by Pascal
02:30
created

ServiceResourceBuilder   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 29
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addError() 0 5 1
A build() 0 5 1
A __construct() 0 3 1
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