Passed
Push — master ( cbdbb3...bd81e8 )
by Jhao
01:58
created

NormalizeAddressRequest::one()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Appwilio\RussianPostSDK\Dispatching\Endpoints\Services\Requests;
6
7
use Appwilio\RussianPostSDK\Dispatching\DataAware;
8
use Appwilio\RussianPostSDK\Dispatching\Contracts\Arrayable;
9
10
final class NormalizeAddressRequest implements Arrayable
11
{
12
    use DataAware;
13
14 1
    public static function one(string $address): self
15
    {
16 1
        $request = new self();
17
18 1
        $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

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