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

src/Api/Endpoint/CreateExpense.php (2 issues)

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 CreateExpense extends \Jane\OpenApiRuntime\Client\BaseEndpoint implements \Jane\OpenApiRuntime\Client\Psr7Endpoint
13
{
14
    public function __construct(\ConnectHolland\TimechimpBundle\Api\Model\Expense $expense)
15
    {
16
        $this->body = $expense;
17
    }
18
19
    use \Jane\OpenApiRuntime\Client\Psr7EndpointTrait;
20
21
    public function getMethod(): string
22
    {
23
        return 'POST';
24
    }
25
26
    public function getUri(): string
27
    {
28
        return '/v1/expenses';
29
    }
30
31
    public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
32
    {
33
        return $this->getSerializedBody($serializer);
0 ignored issues
show
The method getSerializedBody() does not exist on ConnectHolland\Timechimp...\Endpoint\CreateExpense. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

33
        return $this->/** @scrutinizer ignore-call */ getSerializedBody($serializer);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
34
    }
35
36
    public function getExtraHeaders(): array
37
    {
38
        return ['Accept' => ['application/json']];
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     *
44
     * @return \ConnectHolland\TimechimpBundle\Api\Model\Expense|null
45
     */
46
    protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType)
47
    {
48
        if (200 === $status) {
49
            return $serializer->deserialize($body, 'ConnectHolland\\TimechimpBundle\\Api\\Model\\Expense', 'json');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $serializer->dese...Model\Expense', 'json') also could return the type array which is incompatible with the documented return type ConnectHolland\Timechimp...\Api\Model\Expense|null.
Loading history...
50
        }
51
    }
52
}
53