Passed
Push — master ( 9db3d0...354d5b )
by Reyo
02:53
created

GetProjectsByCustomer   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 43
ccs 0
cts 24
cp 0
rs 10
wmc 7

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getUri() 0 3 1
A __construct() 0 3 1
A getMethod() 0 3 1
A transformResponseBody() 0 4 2
A getExtraHeaders() 0 3 1
A getBody() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the timechimp bundle package.
7
 * (c) Connect Holland.
8
 */
9
10
namespace ConnectHolland\TimechimpBundle\Api\Endpoint;
11
12
class GetProjectsByCustomer extends \Jane\OpenApiRuntime\Client\BaseEndpoint implements \Jane\OpenApiRuntime\Client\Psr7Endpoint
13
{
14
    protected $customerId;
15
16
    /**
17
     * @param int $customerId Id of the customer
18
     */
19
    public function __construct(int $customerId)
20
    {
21
        $this->customerId = $customerId;
22
    }
23
24
    use \Jane\OpenApiRuntime\Client\Psr7EndpointTrait;
25
26
    public function getMethod(): string
27
    {
28
        return 'GET';
29
    }
30
31
    public function getUri(): string
32
    {
33
        return str_replace(['{customerId}'], [$this->customerId], '/v1/projects/customer/{customerId}');
34
    }
35
36
    public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
37
    {
38
        return [[], null];
39
    }
40
41
    public function getExtraHeaders(): array
42
    {
43
        return ['Accept' => ['application/json']];
44
    }
45
46
    /**
47
     * {@inheritdoc}
48
     *
49
     * @return \ConnectHolland\TimechimpBundle\Api\Model\Project[]|null
50
     */
51
    protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType)
52
    {
53
        if (200 === $status) {
54
            return $serializer->deserialize($body, 'ConnectHolland\\TimechimpBundle\\Api\\Model\\Project[]', 'json');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $serializer->dese...del\Project[]', 'json') also could return the type object which is incompatible with the documented return type ConnectHolland\Timechimp...pi\Model\Project[]|null.
Loading history...
55
        }
56
    }
57
}
58