| Conditions | 23 |
| Paths | > 20000 |
| Total Lines | 203 |
| Code Lines | 178 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 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 |
||
| 235 | function build_table_series($role, $visitObject) |
||
| 236 | { |
||
| 237 | // Get Series Object Array with details |
||
| 238 | $data_series = $visitObject->getSeriesDetails(); |
||
| 239 | |||
| 240 | $series_number = count($data_series); |
||
| 241 | |||
| 242 | if ($series_number == 0) { |
||
| 243 | return; |
||
| 244 | } |
||
| 245 | |||
| 246 | $colspan = $series_number + 1; |
||
| 247 | ?> |
||
| 248 | <div style="overflow-x:auto;"> |
||
| 249 | <table id="tab_series" class="table table-striped"> |
||
| 250 | <tr> |
||
| 251 | <th colspan=<?=$colspan ?>>Series information</th> |
||
| 252 | </tr> |
||
| 253 | <tr> |
||
| 254 | <td>Series Number</td> |
||
| 255 | <?php |
||
| 256 | for ($i = 0; $i < $series_number; $i ++) { |
||
| 257 | if (empty($data_series[$i]->seriesNumber)) { |
||
| 258 | ?> |
||
| 259 | <td> |
||
| 260 | <?=replaceEmpty($data_series[$i]->seriesNumber)?> |
||
| 261 | </td> |
||
| 262 | <?php |
||
| 263 | }?> |
||
| 264 | </tr> |
||
| 265 | <tr> |
||
| 266 | <td>Manufacturer</td> |
||
| 267 | <?php |
||
| 268 | for ($i = 0; |
||
| 269 | } |
||
|
|
|||
| 270 | $i < $series_number; $i ++) { |
||
| 271 | ?> |
||
| 272 | <td> |
||
| 273 | <?=replaceEmpty($data_series[$i]->manufacturer)?> |
||
| 274 | </td> |
||
| 275 | <?php |
||
| 276 | }?> |
||
| 277 | </tr> |
||
| 278 | <tr> |
||
| 279 | <td>Series Description</td> |
||
| 280 | <?php |
||
| 281 | for ($i=0; $i < $series_number; $i++) { |
||
| 282 | ?> |
||
| 283 | <td> |
||
| 284 | <?=replaceEmpty($data_series[$i]->seriesDescription)?> |
||
| 285 | </td> |
||
| 286 | <?php |
||
| 287 | } |
||
| 288 | ?> |
||
| 289 | </tr> |
||
| 290 | <tr> |
||
| 291 | <td>Modality</td> |
||
| 292 | <?php |
||
| 293 | for ($i=0; $i < $series_number; $i++) { |
||
| 294 | ?> |
||
| 295 | <td> |
||
| 296 | <?=replaceEmpty($data_series[$i]->modality)?> |
||
| 297 | </td> |
||
| 298 | <?php |
||
| 299 | } |
||
| 300 | ?> |
||
| 301 | </tr> |
||
| 302 | <tr> |
||
| 303 | <td>Acquisition Date Time</td> |
||
| 304 | <?php |
||
| 305 | for ($i=0; $i < $series_number; $i++) { |
||
| 306 | ?> |
||
| 307 | <td> |
||
| 308 | <?=replaceEmpty($data_series[$i]->acquisitionDateTime)?> |
||
| 309 | </td> |
||
| 310 | <?php |
||
| 311 | } |
||
| 312 | ?> |
||
| 313 | </tr> |
||
| 314 | <tr> |
||
| 315 | <td>Total Dose (MBq)</td> |
||
| 316 | <?php |
||
| 317 | for ($i = 0; $i < $series_number; $i ++) { |
||
| 318 | ?> |
||
| 319 | <td> |
||
| 320 | <?php if (empty($data_series[$i]->injectedDose)){ |
||
| 321 | echo('/'); |
||
| 322 | } else{ |
||
| 323 | echo(htmlspecialchars($data_series[$i]->injectedDose / 10 ** 6)); |
||
| 324 | } |
||
| 325 | ?> |
||
| 326 | </td> |
||
| 327 | <?php |
||
| 328 | } |
||
| 329 | ?> |
||
| 330 | </tr> |
||
| 331 | <tr> |
||
| 332 | <td>Radiopharmaceutical</td> |
||
| 333 | <?php |
||
| 334 | for ($i=0; $i < $series_number; $i++) { |
||
| 335 | ?> |
||
| 336 | <td> |
||
| 337 | <?=replaceEmpty($data_series[$i]->radiopharmaceutical)?> |
||
| 338 | </td> |
||
| 339 | <?php |
||
| 340 | } |
||
| 341 | ?> |
||
| 342 | </tr> |
||
| 343 | <tr> |
||
| 344 | <td>Injection Date Time</td> |
||
| 345 | <?php |
||
| 346 | for ($i=0; $i < $series_number; $i++) { |
||
| 347 | ?> |
||
| 348 | <td> |
||
| 349 | <?=replaceEmpty($data_series[$i]->injectedDateTime)?> |
||
| 350 | </td> |
||
| 351 | <?php |
||
| 352 | } |
||
| 353 | ?> |
||
| 354 | </tr> |
||
| 355 | <tr> |
||
| 356 | <td>Radiopharm. Specific Activity (MBq)</td> |
||
| 357 | <?php |
||
| 358 | for ($i = 0; $i < $series_number; $i ++) { |
||
| 359 | ?> |
||
| 360 | <td> |
||
| 361 | <?php if (empty($data_series[$i]->injectedActivity)){ |
||
| 362 | echo('/'); |
||
| 363 | } else{ |
||
| 364 | echo(htmlspecialchars($data_series[$i]->injectedActivity / 10 ** 6)); |
||
| 365 | } |
||
| 366 | ?> |
||
| 367 | </td> |
||
| 368 | <?php |
||
| 369 | } |
||
| 370 | ?> |
||
| 371 | </tr> |
||
| 372 | <tr> |
||
| 373 | <td>Half Life (s)</td> |
||
| 374 | <?php |
||
| 375 | for ($i=0; $i < $series_number; $i++) { |
||
| 376 | ?> |
||
| 377 | <td> |
||
| 378 | <?=replaceEmpty($data_series[$i]->halfLife)?> |
||
| 379 | </td> |
||
| 380 | <?php |
||
| 381 | } |
||
| 382 | ?> |
||
| 383 | </tr> |
||
| 384 | <tr> |
||
| 385 | <td>Patient's Weight (kg)</td> |
||
| 386 | <?php |
||
| 387 | for ($i=0; $i < $series_number; $i++) { |
||
| 388 | ?> |
||
| 389 | <td> |
||
| 390 | <?=replaceEmpty($data_series[$i]->patientWeight)?> |
||
| 391 | </td> |
||
| 392 | <?php |
||
| 393 | } |
||
| 394 | ?> |
||
| 395 | </tr> |
||
| 396 | <tr> |
||
| 397 | <td>Slice Count</td> |
||
| 398 | <?php |
||
| 399 | for ($i=0; $i < $series_number; $i++) { |
||
| 400 | ?> |
||
| 401 | <td> |
||
| 402 | <?=replaceEmpty($data_series[$i]->numberInstances)?> |
||
| 403 | </td> |
||
| 404 | <?php |
||
| 405 | } |
||
| 406 | ?> |
||
| 407 | </tr> |
||
| 408 | <tr> |
||
| 409 | <td>Upload Date</td> |
||
| 410 | <?php |
||
| 411 | for ($i=0; $i < $series_number; $i++) { |
||
| 412 | ?> |
||
| 413 | <td> |
||
| 414 | <?=replaceEmpty($data_series[$i]->studyDetailsObject->uploadDate)?> |
||
| 415 | </td> |
||
| 416 | <?php |
||
| 417 | } |
||
| 418 | ?> |
||
| 419 | </tr> |
||
| 420 | <?php |
||
| 421 | if (($role == User::INVESTIGATOR || $role == User::CONTROLLER) && ($visitObject->stateQualityControl != Visit::QC_ACCEPTED && $visitObject->stateQualityControl != Visit::QC_REFUSED)) { |
||
| 422 | ?><tr> |
||
| 423 | <td>Delete</td> |
||
| 424 | <?php |
||
| 425 | for ($i=0; $i < $series_number; $i++) { |
||
| 426 | ?> |
||
| 427 | <td> |
||
| 428 | <a href=scripts/change_series_deletion.php?action=delete&Series_Orthanc_Id=<?=htmlspecialchars($data_series[$i]->seriesOrthancID)?> class="ajaxLinkConfirm" ><input class="btn btn-danger" type="button" value="Delete Series"></a> |
||
| 429 | </td> |
||
| 430 | <?php |
||
| 431 | } |
||
| 432 | ?> |
||
| 433 | </tr> |
||
| 434 | <tr> |
||
| 435 | <td colspan="<?=$colspan?>"> |
||
| 436 | <a href=scripts/change_series_deletion.php?action=delete&Series_Orthanc_Id=allVisit<?=$visitObject->id_visit?> class="ajaxLinkConfirm" ><input class="btn btn-danger" type="button" value="Delete All (Reset Upload)"></a> |
||
| 437 | </td> |
||
| 438 | </tr> |
||
| 445 | ?> |