Passed
Push — master ( 61b2f8...584670 )
by Chubarov
05:03
created

CheckTicketRequest   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 49
rs 10
c 0
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A setTimeoutStrategy() 0 3 1
A getTypeMessage() 0 3 1
A getResponse() 0 3 1
A isProcessFinished() 0 3 1
A getXmlResponseClass() 0 3 1
A executeRequest() 0 3 1
A send() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Fns\GetMessage\Request;
5
6
use Fns\Contracts\RequestsManager;
7
use Fns\Contracts\ResponseSendMessage;
8
use Fns\Contracts\SetTimeoutHandler;
9
use Fns\Contracts\TimeoutStrategyHandler;
10
use Fns\GetMessage\Response\CheckTicketXmlResponse;
11
12
class CheckTicketRequest extends GetMessageRequest implements RequestsManager, SetTimeoutHandler
13
{
14
    private $response;
15
    /**
16
     * @var ResponseSendMessage
17
     */
18
    private $xmlResponse;
19
20
    private $handlerXmlResponse = CheckTicketXmlResponse::class;
0 ignored issues
show
introduced by
The private property $handlerXmlResponse is not used, and could be removed.
Loading history...
21
22
    /**
23
     * @var TimeoutStrategyHandler
24
     */
25
    private $strategyTimeout;
26
27
    public function isProcessFinished() : bool
28
    {
29
        return $this->isCompleted($this->response);
30
    }
31
32
    public function executeRequest() : void
33
    {
34
        $this->response = $this->client->__soapCall('GetMessage', $this->getXml());
35
    }
36
37
    public function setTimeoutStrategy(TimeoutStrategyHandler $strategyHandler)
38
    {
39
        $this->strategyTimeout = $strategyHandler;
40
    }
41
42
    public function send()
43
    {
44
        $this->strategyTimeout->handleTimeout();
45
        $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...
46
    }
47
48
    public function getTypeMessage(): string
49
    {
50
        return 'CheckTicket';
51
    }
52
53
    public function getXmlResponseClass(): string
54
    {
55
        return CheckTicketXmlResponse::class;
56
    }
57
58
    public function getResponse(): ResponseSendMessage
59
    {
60
        return $this->xmlResponse;
61
    }
62
}
63