Egrul   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 23 2
1
<?php
2
3
namespace nikserg\CRMCertificateAPI\models\response\Esia;
4
5
/**
6
 * Запросы к ЕСИА
7
 *
8
 * @package nikserg\CRMCertificateAPI\models\response
9
 */
10
class Egrul
11
{
12
    /**
13
     * @var int
14
     */
15
    public $id;
16
    /**
17
     * @var int
18
     */
19
    public $status;
20
    /**
21
     * @var string
22
     */
23
    public $comment;
24
    public $shortName;
25
    public $fullName;
26
    public $ogrn;
27
    public $ogrnip;
28
    public $inn;
29
    public $kpp;
30
    /**
31
     * @var Address
32
     */
33
    public $address;
34
    /**
35
     * @var Person
36
     */
37
    public $head;
38
39
    /**
40
     * @param $json
41
     */
42
    public function __construct($json)
43
    {
44
        $this->id = $json->id;
45
        $this->status = $json->status;
46
        $this->comment = $json->comment;
47
        if (isset($json->data)) {
48
            $data = $json->data;
49
            $this->shortName = $data->organizationShortName;
50
            $this->fullName = $data->organizationFullName ?? null;
51
            $this->ogrn = $data->OGRN ?? null;
52
            $this->ogrnip = $data->OGRNIP ?? null;
53
            $this->inn = $data->INN;
54
            $this->kpp = $data->KPP ?? null;
55
            $this->address = new Address();
56
            $this->address->region = $data->region ?? null;
57
            $this->address->city = $data->city ?? null;
58
            $this->address->street = $data->street ?? null;
59
            $this->address->raw = $data->fiasAddress ?? null;
60
            $this->head = new Person();
61
            $this->head->firstName = $data->headFirstName;
62
            $this->head->middleName = $data->headMiddleName;
63
            $this->head->lastName = $data->headLastName;
64
            $this->head->jobName = $data->headPosition ?? null;
65
        }
66
    }
67
}