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

GetTicketXmlResponse::getReceipt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Fns\GetMessage\Response;
5
6
use Fns\Contracts\ResponseReceipt;
7
use Fns\Contracts\ResponseSendMessage;
8
use Fns\Receipt;
9
use SimpleXMLElement;
10
11
class GetTicketXmlResponse extends SimpleXMLElement implements ResponseSendMessage, ResponseReceipt
12
{
13
    public function isError(): bool
14
    {
15
        return $this->getCode() !== 200;
16
    }
17
18
    public function getCode(): int
19
    {
20
        return (int)$this->Result->Code;
0 ignored issues
show
Bug Best Practice introduced by
The property Result does not exist on Fns\GetMessage\Response\GetTicketXmlResponse. Since you implemented __get, consider adding a @property annotation.
Loading history...
21
    }
22
23
    public function getBody(): string
24
    {
25
        return (string)$this->Result->Ticket;
0 ignored issues
show
Bug Best Practice introduced by
The property Result does not exist on Fns\GetMessage\Response\GetTicketXmlResponse. Since you implemented __get, consider adding a @property annotation.
Loading history...
26
    }
27
28
    public function getReceipt():Receipt
29
    {
30
        return new Receipt($this->getBody());
31
    }
32
}
33