GetContractsService   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A settings() 0 3 1
A obtainContracts() 0 12 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpCfdi\Finkok\Services\Manifest;
6
7
use PhpCfdi\Finkok\Definitions\Services;
8
use PhpCfdi\Finkok\FinkokSettings;
9
10
class GetContractsService
11
{
12
    /** @var FinkokSettings */
13
    private $settings;
14
15 7
    public function __construct(FinkokSettings $settings)
16
    {
17 7
        $this->settings = $settings;
18
    }
19
20 6
    public function settings(): FinkokSettings
21
    {
22 6
        return $this->settings;
23
    }
24
25 6
    public function obtainContracts(GetContractsCommand $command): GetContractsResult
26
    {
27
        // this empty string are for ommiting sending username and password
28 6
        $soapCaller = $this->settings()->createCallerForService(Services::manifest(), '', '');
29 6
        $rawResponse = $soapCaller->call('get_contracts_snid', [
30 6
            'snid' => $command->snid(),
31 6
            'taxpayer_id' => $command->rfc(),
32 6
            'name' => $command->name(),
33 6
            'address' => $command->address(),
34 6
            'email' => $command->email(),
35 6
        ]);
36 6
        return new GetContractsResult($rawResponse);
37
    }
38
}
39