PaymentServiceMap   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 18
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A availableForSend() 0 4 1
A availableForRequest() 0 4 1
A __construct() 0 3 1
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