KrsPerson   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 101
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 2
dl 0
loc 101
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 16 5
1
<?php
2
/**
3
 * MOJEPANSTWO-API
4
 *
5
 * Copyright © 2017 pudelek.org.pl
6
 *
7
 * @license MIT License (MIT)
8
 *
9
 * For the full copyright and license information, please view source file
10
 * that is bundled with this package in the file LICENSE
11
 *
12
 * @author  Marcin Pudełek <[email protected]>
13
 */
14
15
declare (strict_types=1);
16
17
namespace mrcnpdlk\MojePanstwo\Model;
18
19
20
use mrcnpdlk\MojePanstwo\Model\KrsPerson\RelatedEntity;
21
22
class KrsPerson extends ModelAbstract
23
{
24
    const CONTEXT           = 'krs_osoby';
25
    const PULL_NONE         = 0;
26
    const PULL_KRS_ENTITIES = 1;
27
    const PULL_ALL          = KrsPerson::PULL_KRS_ENTITIES;
28
    /**
29
     * ID osoby z KRS
30
     *
31
     * @var integer
32
     **/
33
    public $id;
34
    /**
35
     * krs
36
     *
37
     * @var string
38
     **/
39
    public $imie_pierwsze;
40
    /**
41
     * @var string
42
     */
43
    public $imie_drugie;
44
    /**
45
     * @var string
46
     */
47
    public $imiona;
48
    /**
49
     * @var string
50
     */
51
    public $nazwisko;
52
    /**
53
     * @var string
54
     */
55
    public $plec;
56
    /**
57
     * @var string
58
     */
59
    public $data_urodzenia;
60
    /**
61
     * @var integer
62
     */
63
    public $liczba_zalozyciele;
64
    /**
65
     * @var integer
66
     */
67
    public $liczba_reprezentanci;
68
    /**
69
     * @var integer
70
     */
71
    public $liczba_nadzorcow;
72
    /**
73
     * @var integer
74
     */
75
    public $liczba_wspolnicy;
76
    /**
77
     * @var integer
78
     */
79
    public $liczba_akcjonariusze;
80
    /**
81
     * @var int[]
82
     */
83
    public $gmina_id;
84
    /**
85
     * @var string
86
     */
87
    public $str;
88
    /**
89
     * @var \mrcnpdlk\MojePanstwo\Model\KrsPerson\RelatedEntity[]
90
     */
91
    public $podmioty = [];
92
    /**
93
     * @var string
94
     */
95
    public $privacy;
96
97
98
    /**
99
     * KrsPerson constructor.
100
     *
101
     * @param \stdClass|null $oData
102
     * @param \stdClass|null $oLayers
103
     *
104
     * @throws \mrcnpdlk\MojePanstwo\Exception
105
     */
106 1
    public function __construct(\stdClass $oData = null, \stdClass $oLayers = null)
107
    {
108 1
        parent::__construct($oData);
109 1
        if ($oData) {
110 1
            $this->id             = $this->convertToId($this->id);
111 1
            $this->data_urodzenia = $this->data_urodzenia ? (new \DateTime($this->data_urodzenia))->format('Y-m-d') : null;
112 1
            foreach ((array)$oData->{'krs_osoby.gmina_id'} as $id) {
113 1
                $this->gmina_id[] = (int)$id;
114
            }
115 1
            $tPodmioty = explode('<br/>', $this->str);
116 1
            foreach ($tPodmioty as $desc) {
117 1
                $this->podmioty[] = new RelatedEntity($desc);
118
            }
119
120
        }
121 1
    }
122
}
123