Completed
Push — master ( 3d14b7...0be808 )
by Vuong
01:13
created

AbstractResponse::isCancelled()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * @link https://github.com/phpviet/omnipay-momo
4
 * @copyright (c) PHP Viet
5
 * @license [MIT](http://www.opensource.org/licenses/MIT)
6
 */
7
8
namespace Omnipay\MoMo\Message;
9
10
use Omnipay\Common\Message\AbstractResponse as BaseAbstractResponse;
11
12
/**
13
 * @method AbstractRequest getRequest()
14
 *
15
 * @author Vuong Minh <[email protected]>
16
 * @since 1.0.0
17
 */
18
abstract class AbstractResponse extends BaseAbstractResponse
19
{
20
    use Concerns\ResponseProperties;
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function isSuccessful(): bool
26
    {
27
        return '0' === $this->getCode();
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function isCancelled(): bool
34
    {
35
        return '49' === $this->getCode();
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function getMessage(): ?string
42
    {
43
        return $this->data['message'] ?? null;
44
    }
45
}
46