Passed
Push — master ( 17481c...d9f781 )
by Reyo
02:57
created

src/Api/Endpoint/GetMileageByDateRange.php (1 issue)

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 GetMileageByDateRange extends \Jane\OpenApiRuntime\Client\BaseEndpoint implements \Jane\OpenApiRuntime\Client\Psr7Endpoint
13
{
14
    protected $startDate;
15
    protected $endDate;
16
17
    /**
18
     * @param string $startDate Start date as string in format: YYYY-MM-DD
19
     * @param string $endDate   End date as string in format: YYYY-MM-DD
20
     */
21
    public function __construct(string $startDate, string $endDate)
22
    {
23
        $this->startDate = $startDate;
24
        $this->endDate   = $endDate;
25
    }
26
27
    use \Jane\OpenApiRuntime\Client\Psr7EndpointTrait;
28
29
    public function getMethod(): string
30
    {
31
        return 'GET';
32
    }
33
34
    public function getUri(): string
35
    {
36
        return str_replace(['{startDate}', '{endDate}'], [$this->startDate, $this->endDate], '/v1/mileage/daterange/{startDate}/{endDate}');
37
    }
38
39
    public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
40
    {
41
        return [[], null];
42
    }
43
44
    public function getExtraHeaders(): array
45
    {
46
        return ['Accept' => ['application/json']];
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     *
52
     * @return \ConnectHolland\TimechimpBundle\Api\Model\Mileage[]|null
53
     */
54
    protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType)
55
    {
56
        if (200 === $status) {
57
            return $serializer->deserialize($body, 'ConnectHolland\\TimechimpBundle\\Api\\Model\\Mileage[]', 'json');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $serializer->dese...del\Mileage[]', 'json') also could return the type object which is incompatible with the documented return type ConnectHolland\Timechimp...pi\Model\Mileage[]|null.
Loading history...
58
        }
59
    }
60
}
61