Conditions | 53 |
Paths | > 20000 |
Total Lines | 217 |
Code Lines | 106 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
38 | public static function insertOtherFields($conn, $individuals, $obje_ids, $sour_ids) |
||
39 | { |
||
40 | foreach ($individuals as $individual) { |
||
41 | $g_id = $individual->getId(); |
||
42 | $name = ''; |
||
43 | $givn = ''; |
||
44 | $surn = ''; |
||
45 | $name = ''; |
||
46 | $npfx = ''; |
||
47 | $givn = ''; |
||
48 | $nick = ''; |
||
49 | $spfx = ''; |
||
50 | $surn = ''; |
||
51 | $nsfx = ''; |
||
52 | $type = ''; |
||
53 | $fone = null; // Gedcom/ |
||
54 | $romn = null; |
||
55 | $names = $individual->getName(); |
||
56 | $attr = $individual->getAllAttr(); |
||
57 | $events = $individual->getAllEven(); |
||
58 | $note = $individual->getNote(); |
||
59 | $indv_sour = $individual->getSour(); |
||
60 | $alia = $individual->getAlia(); // string array |
||
61 | $asso = $individual->getAsso(); |
||
62 | $subm = $individual->getSubm(); |
||
63 | $anci = $individual->getAnci(); |
||
64 | // $desi = $individual->getDesi(); |
||
65 | $refn = $individual->getRefn(); // |
||
66 | $obje = $individual->getObje(); |
||
67 | // object |
||
68 | $bapl = $individual->getBapl(); |
||
69 | $conl = $individual->getConl(); |
||
70 | $endl = $individual->getEndl(); |
||
71 | $slgc = $individual->getSlgc(); |
||
72 | $chan = $individual->getChan(); |
||
73 | $g_id = $individual->getId(); |
||
74 | |||
75 | if (!empty($names)) { |
||
76 | $name = current($names)->getName(); |
||
77 | $npfx = current($names)->getNpfx(); |
||
78 | $givn = current($names)->getGivn(); |
||
79 | $nick = current($names)->getNick(); |
||
80 | $spfx = current($names)->getSpfx(); |
||
81 | $surn = current($names)->getSurn(); |
||
82 | $nsfx = current($names)->getNsfx(); |
||
83 | $type = current($names)->getType(); |
||
84 | } |
||
85 | |||
86 | // array value |
||
87 | $fams = $individual->getFams(); // self family, leave it now, note would be included in family |
||
88 | $famc = $individual->getFamc(); // parent family , leave it now, note and pedi would be included in family |
||
89 | |||
90 | // added to database |
||
91 | // string value |
||
92 | $sex = preg_replace('/[^MF]/', '', $individual->getSex()); |
||
93 | $uid = $individual->getUid(); |
||
94 | $resn = $individual->getResn(); |
||
95 | $rin = $individual->getRin(); |
||
96 | $rfn = $individual->getRfn(); |
||
97 | $afn = $individual->getAfn(); |
||
98 | |||
99 | if ($givn == '') { |
||
100 | $givn = $name; |
||
101 | } |
||
102 | |||
103 | //$person = Person::on($conn)->where('name', $name)->where('givn', $givn)->where('surn', $surn)->where('sex', $sex)->first(); |
||
104 | $person = Person::on($conn)->where('name', $name)->first(); |
||
105 | |||
106 | if ($events !== null) { |
||
107 | Even::read($conn, $events, $person, $obje_ids); |
||
108 | // foreach ($events as $event) { |
||
109 | // if ($event && count($event) > 0) { |
||
110 | // $e_data = $event[0]; |
||
111 | // Even::read($conn, $e_data, $person, $obje_ids); |
||
112 | // } |
||
113 | // } |
||
114 | } |
||
115 | |||
116 | if ($attr !== null) { |
||
117 | Even::read($conn, $attr, $person); |
||
118 | // foreach ($attr as $event) { |
||
119 | // $e_data = $event[0]; |
||
120 | // Even::read($conn, $e_data, $person); |
||
121 | // } |
||
122 | } |
||
123 | |||
124 | $_group = 'indi'; |
||
125 | $_gid = $person->id ?? 0; |
||
126 | if ($names != null && count($names) > 0) { |
||
127 | // Name::read($conn, $names, $_group, $_gid); |
||
128 | foreach ($names as $item) { |
||
129 | if ($item) { |
||
130 | Name::read($conn, $item, $_group, $_gid); |
||
131 | } |
||
132 | } |
||
133 | } |
||
134 | |||
135 | if ($note != null && count($note) > 0) { |
||
136 | // NoteRef::read($conn, $note, $_group, $_gid); |
||
137 | foreach ($note as $item) { |
||
138 | if ($item) { |
||
139 | NoteRef::read($conn, $item, $_group, $_gid); |
||
140 | } |
||
141 | } |
||
142 | } |
||
143 | |||
144 | if ($indv_sour != null && count($indv_sour) > 0) { |
||
145 | // SourRef::read($conn, $indv_sour, $_group, $_gid, $sour_ids, $obje_ids); |
||
146 | foreach ($indv_sour as $item) { |
||
147 | if ($item) { |
||
148 | SourRef::read($conn, $item, $_group, $_gid, $sour_ids, $obje_ids); |
||
149 | } |
||
150 | } |
||
151 | } |
||
152 | |||
153 | // ?? |
||
154 | if ($alia && count($alia) > 0) { |
||
155 | Alia::read($conn, $alia, $_group, $_gid); |
||
156 | // foreach ($alia as $item) { |
||
157 | // if ($item) { |
||
158 | // Alia::read($conn, $item, $_group, $_gid); |
||
159 | // } |
||
160 | // } |
||
161 | } |
||
162 | |||
163 | if ($asso && count($asso) > 0) { |
||
164 | // Asso::read($conn, $item, $_group, $_gid); |
||
165 | foreach ($asso as $item) { |
||
166 | if ($item) { |
||
167 | Asso::read($conn, $item, $_group, $_gid); |
||
168 | } |
||
169 | } |
||
170 | } |
||
171 | |||
172 | if ($subm && count($subm) > 0) { |
||
173 | Subm::read($conn, $subm, $_group, $_gid, $obje_ids); |
||
174 | // foreach ($subm as $item) { |
||
175 | // if ($item) { |
||
176 | // Subm::read($conn, $item, $_group, $_gid, $subm_ids); |
||
177 | // } |
||
178 | // } |
||
179 | } |
||
180 | |||
181 | if ($anci && count($anci) > 0) { |
||
182 | Anci::read($conn, $anci, $_group, $_gid, $obje_ids); |
||
183 | // foreach ($anci as $item) { |
||
184 | // if ($item) { |
||
185 | // Anci::read($conn, $item, $_group, $_gid, $subm_ids); |
||
186 | // } |
||
187 | // } |
||
188 | } |
||
189 | |||
190 | // if ($desi && count($desi) > 0) { |
||
191 | // foreach ($desi as $item) { |
||
192 | // if ($item) { |
||
193 | // Desi::read($conn, $item, $_group, $_gid, $subm_ids); |
||
194 | // } |
||
195 | // } |
||
196 | // } |
||
197 | |||
198 | if ($refn && count($refn) > 0) { |
||
199 | // Refn::read($conn, $refn, $_group, $_gid); |
||
200 | foreach ($refn as $item) { |
||
201 | if ($item) { |
||
202 | Refn::read($conn, $item, $_group, $_gid); |
||
203 | } |
||
204 | } |
||
205 | } |
||
206 | |||
207 | if ($obje && count($obje) > 0) { |
||
208 | // ObjeRef::read($conn, $obje, $_group, $_gid, $obje_ids); |
||
209 | foreach ($obje as $item) { |
||
210 | if ($item) { |
||
211 | ObjeRef::read($conn, $item, $_group, $_gid, $obje_ids); |
||
212 | } |
||
213 | } |
||
214 | } |
||
215 | |||
216 | if ($bapl && count($bapl) > 0) { |
||
217 | // Lds::read($conn, $bapl, $_group, $_gid, 'BAPL', $sour_ids, $obje_ids); |
||
218 | foreach ($bapl as $item) { |
||
219 | if ($item) { |
||
220 | Lds::read($conn, $item, $_group, $_gid, 'BAPL', $sour_ids, $obje_ids); |
||
221 | } |
||
222 | } |
||
223 | } |
||
224 | |||
225 | if ($conl && count($conl) > 0) { |
||
226 | // Lds::read($conn, $conl, $_group, $_gid, 'CONL', $sour_ids, $obje_ids); |
||
227 | foreach ($conl as $item) { |
||
228 | if ($item) { |
||
229 | Lds::read($conn, $item, $_group, $_gid, 'CONL', $sour_ids, $obje_ids); |
||
230 | } |
||
231 | } |
||
232 | } |
||
233 | |||
234 | if ($endl && count($endl) > 0) { |
||
235 | // Lds::read($conn, $endl, $_group, $_gid, 'ENDL', $sour_ids, $obje_ids); |
||
236 | foreach ($endl as $item) { |
||
237 | if ($item) { |
||
238 | Lds::read($conn, $item, $_group, $_gid, 'ENDL', $sour_ids, $obje_ids); |
||
239 | } |
||
240 | } |
||
241 | } |
||
242 | |||
243 | if ($slgc && count($slgc) > 0) { |
||
244 | // Lds::read($conn, $slgc, $_group, $_gid, 'SLGC', $sour_ids, $obje_ids); |
||
245 | |||
246 | foreach ($slgc as $item) { |
||
247 | if ($item) { |
||
248 | Lds::read($conn, $item, $_group, $_gid, 'SLGC', $sour_ids, $obje_ids); |
||
249 | } |
||
250 | } |
||
251 | } |
||
252 | |||
253 | if ($chan) { |
||
254 | Chan::read($conn, $chan, $_group, $_gid); |
||
255 | } |
||
259 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths