Completed
Push — master ( 3dc30b...6a0dc0 )
by Jhao
04:34 queued 02:01
created

CheckRecipientRequest::one()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 7
rs 10
cc 1
nc 1
nop 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Appwilio\RussianPostSDK\Dispatching\Endpoints\Services\Requests;
6
7
use Appwilio\RussianPostSDK\Dispatching\Contracts\Arrayable;
8
9
final class CheckRecipientRequest implements Arrayable
10
{
11
    private $items = [];
12
13
    public static function create(): self
14
    {
15
        return new self();
16
    }
17
18
    public static function one(string $address, string $fullName, string $phone): self
19
    {
20
        $request = self::create();
21
22
        $request->addRecipient(...\func_get_args());
23
24
        return $request;
25
    }
26
27
    public function addRecipient(string $address, string $fullName, string $phone): void
28
    {
29
        $this->items[] = [
30
            'raw-address'   => $address,
31
            'raw-telephone' => $phone,
32
            'raw-full-name' => $fullName,
33
        ];
34
    }
35
36
    public function toArray(): array
37
    {
38
        return $this->items;
39
    }
40
}
41