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

GetTicketXmlResponse   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 20
rs 10
c 1
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getCode() 0 3 1
A getBody() 0 3 1
A isError() 0 3 1
A getReceipt() 0 3 1
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