SmsRuConfig   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 18
dl 0
loc 57
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A toArray() 0 10 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Kafkiansky\SmsRu;
6
7
final class SmsRuConfig
8
{
9
    use Parameterizable;
10
11
    /**
12
     * @var string|null
13
     */
14
    private $apiId;
15
16
    /**
17
     * @var int|null
18
     */
19
    private $json;
20
21
    /**
22
     * @var string|null
23
     */
24
    private $login;
25
26
    /**
27
     * @var string|null
28
     */
29
    private $password;
30
31
    /**
32
     * @var int|null
33
     */
34
    private $partnerId;
35
36
    /**
37
     * @var int|null
38
     */
39
    private $test;
40
41
    /**
42
     * @var string|null
43
     */
44
    private $from;
45
46
    public function __construct(array $config)
47
    {
48
        $this->fillFromParameters($config);
49
    }
50
51
    /**
52
     * @return array
53
     */
54
    public function toArray(): array
55
    {
56
        return \array_filter([
57
            'api_id'     => $this->apiId,
58
            'login'      => $this->login,
59
            'password'   => $this->password,
60
            'json'       => $this->json,
61
            'partner_id' => $this->partnerId,
62
            'test'       => $this->test,
63
            'from'       => $this->from,
64
        ]);
65
    }
66
}
67