1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Defr\Ares; |
4
|
|
|
|
5
|
|
|
use Defr\Justice; |
6
|
|
|
use Goutte\Client; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class AresRecord. |
10
|
|
|
* |
11
|
|
|
* @author Dennis Fridrich <[email protected]> |
12
|
|
|
*/ |
13
|
|
|
class AresRecord |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* @var int |
17
|
|
|
*/ |
18
|
|
|
private $companyId; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @var string |
22
|
|
|
*/ |
23
|
|
|
private $taxId; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @var string |
27
|
|
|
*/ |
28
|
|
|
private $companyName; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var string |
32
|
|
|
*/ |
33
|
|
|
private $street; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @var string |
37
|
|
|
*/ |
38
|
|
|
private $streetHouseNumber; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var string |
42
|
|
|
*/ |
43
|
|
|
private $streetOrientationNumber; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @var string |
47
|
|
|
*/ |
48
|
|
|
private $town; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @var string |
52
|
|
|
*/ |
53
|
|
|
private $zip; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* AresRecord constructor. |
57
|
|
|
* @param int $companyId |
58
|
|
|
* @param string $taxId |
59
|
|
|
* @param string $companyName |
60
|
|
|
* @param string $street |
61
|
|
|
* @param string $streetHouseNumber |
62
|
|
|
* @param string $streetOrientationNumber |
63
|
|
|
* @param string $town |
64
|
|
|
* @param string $zip |
65
|
|
|
*/ |
66
|
1 |
|
public function __construct($companyId, $taxId, $companyName, $street, $streetHouseNumber, $streetOrientationNumber, $town, $zip) |
67
|
|
|
{ |
68
|
1 |
|
$this->companyId = $companyId; |
69
|
1 |
|
$this->taxId = !empty($taxId) ? $taxId : null; |
70
|
1 |
|
$this->companyName = $companyName; |
71
|
1 |
|
$this->street = $street; |
72
|
1 |
|
$this->streetHouseNumber = !empty($streetHouseNumber) ? $streetHouseNumber : null; |
73
|
1 |
|
$this->streetOrientationNumber = !empty($streetOrientationNumber) ? $streetOrientationNumber : null; |
74
|
1 |
|
$this->town = $town; |
75
|
1 |
|
$this->zip = $zip; |
76
|
1 |
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @return string |
80
|
|
|
*/ |
81
|
|
|
public function getStreetWithNumbers() |
82
|
|
|
{ |
83
|
|
|
return $this->street.' ' |
84
|
|
|
.($this->streetOrientationNumber |
85
|
|
|
? |
86
|
|
|
$this->streetHouseNumber.'/'.$this->streetOrientationNumber |
87
|
|
|
: |
88
|
|
|
$this->streetHouseNumber); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @return mixed |
93
|
|
|
*/ |
94
|
|
|
public function __toString() |
95
|
|
|
{ |
96
|
|
|
return $this->companyName; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @return mixed |
101
|
|
|
*/ |
102
|
1 |
|
public function getCompanyId() |
103
|
|
|
{ |
104
|
1 |
|
return $this->companyId; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* @return mixed |
109
|
|
|
*/ |
110
|
1 |
|
public function getTaxId() |
111
|
|
|
{ |
112
|
1 |
|
return $this->taxId; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @return mixed |
117
|
|
|
*/ |
118
|
1 |
|
public function getCompanyName() |
119
|
|
|
{ |
120
|
1 |
|
return $this->companyName; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* @return mixed |
125
|
|
|
*/ |
126
|
1 |
|
public function getStreet() |
127
|
|
|
{ |
128
|
1 |
|
return $this->street; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* @return mixed |
133
|
|
|
*/ |
134
|
1 |
|
public function getStreetHouseNumber() |
135
|
|
|
{ |
136
|
1 |
|
return $this->streetHouseNumber; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* @return mixed |
141
|
|
|
*/ |
142
|
1 |
|
public function getStreetOrientationNumber() |
143
|
|
|
{ |
144
|
1 |
|
return $this->streetOrientationNumber; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* @return mixed |
149
|
|
|
*/ |
150
|
1 |
|
public function getTown() |
151
|
|
|
{ |
152
|
1 |
|
return $this->town; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @return mixed |
157
|
|
|
*/ |
158
|
1 |
|
public function getZip() |
159
|
|
|
{ |
160
|
1 |
|
return $this->zip; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @return array |
165
|
|
|
*/ |
166
|
|
|
public function getCompanyPeople() |
167
|
|
|
{ |
168
|
|
|
$justice = new Justice(new Client()); |
169
|
|
|
$justiceRecord = $justice->findById($this->companyId); |
170
|
|
|
if ($justiceRecord) { |
171
|
|
|
return $justiceRecord->getPeople(); |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
return []; |
175
|
|
|
} |
176
|
|
|
} |
177
|
|
|
|