|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace ADiaz\AML\OpenList\models; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* This file is part of the OpenList Parser utility. |
|
7
|
|
|
* |
|
8
|
|
|
* @category PHP |
|
9
|
|
|
* |
|
10
|
|
|
* @author Alberto Diaz <[email protected]> |
|
11
|
|
|
* @copyright 2016 Alberto Diaz <[email protected]> |
|
12
|
|
|
* @license This source file is subject to the MIT license that is bundled |
|
13
|
|
|
* |
|
14
|
|
|
* @version Release: @package_version@ |
|
15
|
|
|
* |
|
16
|
|
|
* @link http://tytem.com |
|
17
|
|
|
*/ |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Class Entity. |
|
21
|
|
|
*/ |
|
22
|
|
|
class Entity |
|
23
|
|
|
{ |
|
24
|
|
|
public $external_id; |
|
25
|
|
|
public $first_name; |
|
26
|
|
|
public $last_name; |
|
27
|
|
|
public $name_original_script; |
|
28
|
|
|
public $type; |
|
29
|
|
|
public $title; |
|
30
|
|
|
public $position; |
|
31
|
|
|
public $program_list; |
|
32
|
|
|
public $aka_list; |
|
33
|
|
|
public $address_list; |
|
34
|
|
|
public $id_list; |
|
35
|
|
|
public $nationality_list; |
|
36
|
|
|
public $citizenship_list; |
|
37
|
|
|
public $date_of_birth_list; |
|
38
|
|
|
public $place_of_birth_list; |
|
39
|
|
|
public $vessel; |
|
40
|
|
|
public $remarks; |
|
41
|
|
|
public $update_at_list; |
|
42
|
|
|
|
|
43
|
|
|
/* Individual */ |
|
44
|
|
|
const TYPE_INDIVIDUAL = 'Individual'; |
|
45
|
|
|
|
|
46
|
|
|
/* Entity / Company */ |
|
47
|
|
|
const TYPE_ENTITY = 'Entity'; |
|
48
|
|
|
|
|
49
|
|
|
/* prime alias */ |
|
50
|
|
|
const ALIAS_TYPE_PRIME_ALIAS = 'Prime Alias'; |
|
51
|
|
|
|
|
52
|
|
|
/* also known as */ |
|
53
|
|
|
const ALIAS_TYPE_AKA = 'AKA'; |
|
54
|
|
|
|
|
55
|
|
|
/* formerly known as */ |
|
56
|
|
|
const ALIAS_TYPE_FKA = 'FKA'; |
|
57
|
|
|
|
|
58
|
11 |
|
public function __construct($external_id) |
|
59
|
|
|
{ |
|
60
|
11 |
|
$this->id_list = []; |
|
61
|
11 |
|
$this->aka_list = []; |
|
62
|
11 |
|
$this->address_list = []; |
|
63
|
11 |
|
$this->program_list = []; |
|
64
|
11 |
|
$this->address_list = []; |
|
65
|
11 |
|
$this->nationality_list = []; |
|
66
|
11 |
|
$this->citizenship_list = []; |
|
67
|
11 |
|
$this->date_of_birth_list = []; |
|
68
|
11 |
|
$this->place_of_birth_list = []; |
|
69
|
11 |
|
$this->update_at_list = []; |
|
70
|
11 |
|
$this->external_id = $external_id; |
|
71
|
11 |
|
} |
|
72
|
|
|
|
|
73
|
2 |
|
public function addAka(Aka $aka) |
|
74
|
|
|
{ |
|
75
|
2 |
|
if (!$this->isEmpty($aka) && !in_array($aka, $this->aka_list)) { |
|
76
|
2 |
|
$this->aka_list[] = $aka; |
|
77
|
|
|
} |
|
78
|
2 |
|
} |
|
79
|
|
|
|
|
80
|
2 |
|
public function addId(Id $documentId) |
|
81
|
|
|
{ |
|
82
|
2 |
|
if (!$this->isEmpty($documentId) && !in_array($documentId, $this->id_list)) { |
|
83
|
2 |
|
$this->id_list[] = $documentId; |
|
84
|
|
|
} |
|
85
|
2 |
|
} |
|
86
|
|
|
|
|
87
|
2 |
|
public function addNationality(Nationality $nationality) |
|
88
|
|
|
{ |
|
89
|
2 |
|
if (!$this->isEmpty($nationality) && !in_array($nationality, $this->nationality_list)) { |
|
90
|
2 |
|
$this->nationality_list[] = $nationality; |
|
91
|
|
|
} |
|
92
|
2 |
|
} |
|
93
|
|
|
|
|
94
|
2 |
|
public function addCitizenship(Citizenship $citizenship) |
|
95
|
|
|
{ |
|
96
|
2 |
|
if (!$this->isEmpty($citizenship) && !in_array($citizenship, $this->citizenship_list)) { |
|
97
|
2 |
|
$this->citizenship_list[] = $citizenship; |
|
98
|
|
|
} |
|
99
|
2 |
|
} |
|
100
|
|
|
|
|
101
|
2 |
|
public function addAddress(Address $address) |
|
102
|
|
|
{ |
|
103
|
2 |
|
if (!$this->isEmpty($address) && !in_array($address, $this->address_list)) { |
|
104
|
2 |
|
$this->address_list[] = $address; |
|
105
|
|
|
} |
|
106
|
2 |
|
} |
|
107
|
|
|
|
|
108
|
2 |
|
public function addDateOfBirth(DateOfBirth $dob) |
|
109
|
|
|
{ |
|
110
|
2 |
|
if (!$this->isEmpty($dob) && !in_array($dob, $this->date_of_birth_list)) { |
|
111
|
2 |
|
$this->date_of_birth_list[] = $dob; |
|
112
|
|
|
} |
|
113
|
2 |
|
} |
|
114
|
|
|
|
|
115
|
2 |
|
public function addPlaceOfBirth(PlaceOfBirth $pob) |
|
116
|
|
|
{ |
|
117
|
2 |
|
if (!$this->isEmpty($pob) && !in_array($pob, $this->place_of_birth_list)) { |
|
118
|
2 |
|
$this->place_of_birth_list[] = $pob; |
|
119
|
|
|
} |
|
120
|
2 |
|
} |
|
121
|
|
|
|
|
122
|
2 |
|
public function addProgram(Program $program) |
|
123
|
|
|
{ |
|
124
|
2 |
|
if (!$this->isEmpty($program) && !in_array($program, $this->program_list)) { |
|
125
|
2 |
|
$this->program_list[] = $program; |
|
126
|
|
|
} |
|
127
|
2 |
|
} |
|
128
|
|
|
|
|
129
|
|
|
public function addUpdateAt($date) |
|
130
|
|
|
{ |
|
131
|
|
|
if ((bool) strtotime($date)) { |
|
132
|
|
|
$this->update_at_list[] = $date; |
|
133
|
|
|
} |
|
134
|
|
|
} |
|
135
|
|
|
|
|
136
|
2 |
|
public function isEmpty($obj) |
|
137
|
|
|
{ |
|
138
|
2 |
|
foreach ($obj as $attribute => $value) { |
|
139
|
2 |
|
if ((is_string($value) && trim($value) !== '')) { |
|
140
|
2 |
|
return false; |
|
141
|
|
|
} |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
2 |
|
return true; |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
2 |
|
public function setter($attribute, $value) |
|
148
|
|
|
{ |
|
149
|
2 |
|
if (property_exists($this, $attribute) && !empty($value)) { |
|
150
|
2 |
|
$this->$attribute = $value; |
|
151
|
|
|
} |
|
152
|
2 |
|
} |
|
153
|
|
|
|
|
154
|
2 |
|
public function setType($type) |
|
155
|
|
|
{ |
|
156
|
2 |
|
$this->type = $type; |
|
157
|
2 |
|
} |
|
158
|
|
|
} |
|
159
|
|
|
|