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

Counterparty::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 3
rs 10
cc 1
nc 1
nop 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