Passed
Push — master ( 65a6b4...cbdbb3 )
by Jhao
02:03
created

NormalizeFioRequest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A one() 0 7 1
A addFio() 0 5 1
A toArray() 0 3 1
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 NormalizeFioRequest implements Arrayable
11
{
12
    use DataAware;
13
14
    public static function one(string $fio): self
15
    {
16
        $request = new self();
17
18
        $request->addFio(...\func_get_args());
0 ignored issues
show
Bug introduced by
func_get_args() is expanded, but the parameter $fio of Appwilio\RussianPostSDK\...izeFioRequest::addFio() 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->addFio(/** @scrutinizer ignore-type */ ...\func_get_args());
Loading history...
19
20
        return $request;
21
    }
22
23
    public function addFio(string $fio): void
24
    {
25
        $this->data[] = [
26
            'id'           => \sha1($fio),
27
            'original-fio' => $fio,
28
        ];
29
    }
30
31
    public function toArray(): array
32
    {
33
        return $this->data;
34
    }
35
}
36