Passed
Branch master (0d8fc3)
by Tomáš
12:26
created

DefaultAccountFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 21
ccs 14
cts 14
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A create() 0 14 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Inspirum\Balikobot\Model\Account;
6
7
use Inspirum\Balikobot\Model\Carrier\CarrierFactory;
8
9
final class DefaultAccountFactory implements AccountFactory
10
{
11 9
    public function __construct(private CarrierFactory $carrierFactory)
12
    {
13
    }
14
15
    /** @inheritDoc */
16 2
    public function create(array $response): Account
17
    {
18 2
        return new DefaultAccount(
19 2
            $response['account']['name'],
20 2
            $response['account']['contact_person'],
21 2
            $response['account']['email'],
22 2
            $response['account']['phone'],
23 2
            $response['account']['url'],
24 2
            $response['account']['street'],
25 2
            $response['account']['city'],
26 2
            $response['account']['zip'],
27 2
            $response['account']['country'],
28 2
            $response['live_account'],
29 2
            $this->carrierFactory->createCollection($response),
30
        );
31
    }
32
}
33