Passed
Push — master ( 77fbef...5b00d5 )
by Sergey
02:50 queued 35s
created

Counterparty   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 8
c 1
b 0
f 1
dl 0
loc 27
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getCounterpartyAddresses() 0 7 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SergeyNezbritskiy\NovaPoshta\Models;
6
7
use RuntimeException;
8
use SergeyNezbritskiy\NovaPoshta\Connection;
9
use SergeyNezbritskiy\NovaPoshta\ModelInterface;
10
use SergeyNezbritskiy\NovaPoshta\NovaPoshtaApiException;
11
12
class Counterparty implements ModelInterface
13
{
14
    private const MODEL_NAME = 'Counterparty';
15
16
    private Connection $connection;
17
18
    /**
19
     * @param Connection $connection
20
     */
21
    public function __construct(Connection $connection)
22
    {
23
        $this->connection = $connection;
24
    }
25
26
    /**
27
     * @param string $counterpartyRef
28
     * @param string $counterpartyProperty
29
     * @return array
30
     * @throws NovaPoshtaApiException
31
     */
32
    public function getCounterpartyAddresses(string $counterpartyRef, string $counterpartyProperty): array
33
    {
34
        $params = [
35
            'Ref' => $counterpartyRef,
36
            'CounterpartyProperty' => $counterpartyProperty,
37
        ];
38
        return $this->connection->post(self::MODEL_NAME, 'getCounterpartyAddresses', $params);
39
    }
40
}
41