FindByAddressRequest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 21
ccs 0
cts 14
cp 0
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A toArray() 0 3 1
A create() 0 3 1
1
<?php
2
3
/**
4
 * This file is part of RussianPost SDK package.
5
 *
6
 * © Appwilio (http://appwilio.com), JhaoDa (https://github.com/jhaoda)
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Appwilio\RussianPostSDK\Dispatching\Endpoints\PostOffices\Requests;
15
16
use Appwilio\RussianPostSDK\Core\Arrayable;
17
18
final class FindByAddressRequest implements Arrayable
19
{
20
    /** @var array */
21
    private $data;
22
23
    public static function create(string $address, int $take = 3): self
24
    {
25
        return new self(...\func_get_args());
0 ignored issues
show
Bug introduced by
func_get_args() is expanded, but the parameter $address of Appwilio\RussianPostSDK\...sRequest::__construct() 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

25
        return new self(/** @scrutinizer ignore-type */ ...\func_get_args());
Loading history...
26
    }
27
28
    public function __construct(string $address, int $take = 3)
29
    {
30
        $this->data = [
31
            'top'     => $take,
32
            'address' => $address,
33
        ];
34
    }
35
36
    public function toArray(): array
37
    {
38
        return $this->data;
39
    }
40
}
41