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

NormalizeAddressRequest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 9
c 1
b 0
f 0
dl 0
loc 24
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A one() 0 7 1
A toArray() 0 3 1
A addAddress() 0 5 1
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 NormalizeAddressRequest implements Arrayable
10
{
11
    private $items = [];
12
13
    public static function one(string $address): self
14
    {
15
        $request = new self();
16
17
        $request->addAddress(...\func_get_args());
0 ignored issues
show
Bug introduced by
func_get_args() is expanded, but the parameter $address of Appwilio\RussianPostSDK\...ssRequest::addAddress() does not expect variable arguments. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

17
        $request->addAddress(/** @scrutinizer ignore-type */ ...\func_get_args());
Loading history...
18
19
        return $request;
20
    }
21
22
    public function addAddress(string $address): void
23
    {
24
        $this->items[] = [
25
            'id'               => \sha1($address),
26
            'original-address' => $address,
27
        ];
28
    }
29
30
    public function toArray(): array
31
    {
32
        return $this->items;
33
    }
34
}
35