Issues (21)

src/GetMessage/Request/GetTicketRequest.php (1 issue)

1
<?php
2
declare(strict_types=1);
3
4
namespace Fns\GetMessage\Request;
5
6
use Fns\GetMessage\Response\GetTicketXmlResponse;
7
use Fns\Contracts\RequestsManager;
8
use Fns\Contracts\ResponseSendMessage;
9
use Fns\Contracts\SetTimeoutHandler;
10
use Fns\Contracts\TimeoutStrategyHandler;
11
12
class GetTicketRequest extends GetMessageRequest implements RequestsManager, SetTimeoutHandler
13
{
14
    private $response;
15
16
    /**
17
     * @var ResponseSendMessage
18
     */
19
    private $xmlResponse;
20
    private $strategyTimeout;
21
22
    public function setTimeoutStrategy(TimeoutStrategyHandler $strategyHandler)
23
    {
24
        $this->strategyTimeout = $strategyHandler;
25
    }
26
27
    public function send()
28
    {
29
        $this->strategyTimeout->handleTimeout();
30
        $this->xmlResponse = simplexml_load_string($this->response->Message->any, $this->getXmlResponseClass());
0 ignored issues
show
Documentation Bug introduced by
It seems like simplexml_load_string($t...>getXmlResponseClass()) of type SimpleXMLElement is incompatible with the declared type Fns\Contracts\ResponseSendMessage of property $xmlResponse.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
31
    }
32
33
    public function getTypeMessage(): string
34
    {
35
        return 'GetTicket';
36
    }
37
38
    public function getXmlResponseClass(): string
39
    {
40
        return GetTicketXmlResponse::class;
41
    }
42
43
    public function getResponse(): ResponseSendMessage
44
    {
45
        return $this->xmlResponse;
46
    }
47
48
    public function isProcessFinished(): bool
49
    {
50
        return $this->isCompleted($this->response);
51
    }
52
53
    public function executeRequest(): void
54
    {
55
        $this->response = $this->client->__soapCall('GetMessage', $this->getXml());
56
    }
57
}
58