1 | <?php |
||
2 | declare(strict_types=1); |
||
3 | |||
4 | namespace Fns; |
||
5 | |||
6 | use Fns\Contracts\ResponseSendMessage; |
||
7 | use Fns\GetMessage\Request\GetMessageRequest; |
||
8 | |||
9 | class SendMessageRequest |
||
10 | { |
||
11 | private $ticket; |
||
12 | |||
13 | /** |
||
14 | * @var ClientSoap |
||
15 | */ |
||
16 | private $client; |
||
17 | /** |
||
18 | * @var GetMessageRequest |
||
19 | */ |
||
20 | private $messageRequest; |
||
21 | private $server; |
||
22 | |||
23 | public function __construct( |
||
24 | ClientSoap $clientSoap, |
||
25 | GetMessageRequest $messageRequest |
||
26 | ) { |
||
27 | $this->client = $clientSoap->getClient(); |
||
0 ignored issues
–
show
|
|||
28 | |||
29 | $this->messageRequest = $messageRequest; |
||
30 | $this->messageRequest->setClient($clientSoap); |
||
31 | } |
||
32 | |||
33 | protected function getXml() : array |
||
34 | { |
||
35 | $type = $this->messageRequest->getTypeMessage(); |
||
36 | |||
37 | return [[ |
||
38 | 'Message' => [ |
||
39 | 'any' => "<{$type}Request xmlns=\"urn://x-artefacts-gnivc-ru/ais3/kkt/KktTicketService/types/1.0\" |
||
40 | xmlns:tns=\"urn://x-artefacts-gnivc-ru/ais3/kkt/KktTicketService/types/1.0\"> |
||
41 | <tns:{$type}Info> |
||
42 | {$this->ticket->asXml()} |
||
43 | </tns:{$type}Info> |
||
44 | </{$type}Request>" |
||
45 | ] |
||
46 | ]]; |
||
47 | } |
||
48 | |||
49 | public function setTicket(Ticket $ticket) |
||
50 | { |
||
51 | $this->ticket = $ticket; |
||
52 | } |
||
53 | |||
54 | public function execute() : ResponseSendMessage |
||
55 | { |
||
56 | $messageId = $this->client->__soapCall('SendMessage', $this->getXml())->MessageId; |
||
57 | |||
58 | $this->messageRequest->setMessageId($messageId); |
||
59 | $this->messageRequest->send(); |
||
60 | return $this->messageRequest->getResponse(); |
||
61 | } |
||
62 | } |
||
63 |
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..