FindByAddressRequest::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 5
ccs 0
cts 5
cp 0
crap 2
rs 10
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