TransactionAcceptedSpecification::isSatisfiedBy()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 4
nc 4
nop 1
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Korobovn\CloudPayments\Message\Strategy\Specification;
6
7
/**
8
 * @see https://developers.cloudpayments.ru/#oplata-po-kriptogramme
9
 */
10
class TransactionAcceptedSpecification implements SpecificationInterface
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function isSatisfiedBy(array $response): bool
16
    {
17
        return isset($response['Model']['ReasonCode']) &&
18
               $response['Model']['ReasonCode'] === 0 &&
19
               (new IsSuccessSpecification)->isSatisfiedBy($response) &&
20
               (new NotMessageSpecification)->isSatisfiedBy($response);
21
    }
22
}
23