PaymentServiceMap::availableForRequest()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
/**
3
 * This file is part of the daikon-cqrs/money-interop project.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace Daikon\Money\Service;
10
11
use Daikon\DataStructure\TypedMap;
12
use Daikon\Money\ValueObject\MoneyInterface;
13
14
final class PaymentServiceMap extends TypedMap
15
{
16 3
    public function __construct(iterable $services = [])
17
    {
18 3
        $this->init($services, [PaymentServiceInterface::class]);
19 3
    }
20
21 1
    public function availableForRequest(MoneyInterface $amount): self
22
    {
23 1
        return $this->filter(
24 1
            fn(string $key, PaymentServiceInterface $paymentService): bool => $paymentService->canRequest($amount)
25 1
        );
26
    }
27
28 1
    public function availableForSend(MoneyInterface $amount): self
29
    {
30 1
        return $this->filter(
31 1
            fn(string $key, PaymentServiceInterface $paymentService): bool => $paymentService->canSend($amount)
32 1
        );
33
    }
34
}
35