SubscriptionsInModelSpecification::isSatisfiedBy()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 6
nc 4
nop 1
dl 0
loc 13
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/#poisk-podpisok
9
 */
10
class SubscriptionsInModelSpecification implements SpecificationInterface
11
{
12
    /**
13
     * {@inheritDoc}
14
     */
15
    public function isSatisfiedBy(array $response): bool
16
    {
17
        if (! is_array($response['Model'])) {
18
            return false;
19
        }
20
21
        foreach ($response['Model'] as $item) {
22
            if (empty($item['Id'])) {
23
                return false;
24
            }
25
        }
26
27
        return true;
28
    }
29
}
30