| Conditions | 23 |
| Paths | > 20000 |
| Total Lines | 215 |
| Code Lines | 197 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | 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 |
||
| 308 | function build_table_series($role, $visitObject) |
||
| 309 | { |
||
| 310 | // Get Series Object Array with details |
||
| 311 | $data_series=$visitObject->getSeriesDetails(); |
||
| 312 | |||
| 313 | $series_number=count($data_series); |
||
| 314 | |||
| 315 | if ($series_number == 0) return; |
||
| 316 | |||
| 317 | $colspan=$series_number+1; |
||
| 318 | ?> |
||
| 319 | <div class="accordion mt-3" id="accordionExample"> |
||
| 320 | <div > |
||
| 321 | <div id="headingOne"> |
||
| 322 | <h2 class="mb-0"> |
||
| 323 | <button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#seriesDetails" aria-expanded="true" aria-controls="collapseOne"> |
||
| 324 | Show/Hide Series Details |
||
| 325 | </button> |
||
| 326 | </h2> |
||
| 327 | </div> |
||
| 328 | |||
| 329 | <div id="seriesDetails" class="show mt-3" aria-labelledby="headingOne" data-parent="#accordionExample"> |
||
| 330 | <div> |
||
| 331 | <div style="overflow-x:auto;"> |
||
| 332 | <table id="tab_series" class="table table-striped"> |
||
| 333 | <tr> |
||
| 334 | <th colspan=<?=$colspan ?>>Series information</th> |
||
| 335 | </tr> |
||
| 336 | <tr> |
||
| 337 | <td>Series Number</td> |
||
| 338 | <?php |
||
| 339 | for ($i=0; $i < $series_number; $i++) { |
||
| 340 | if (empty($data_series[$i]->seriesNumber)) |
||
| 341 | ?> |
||
| 342 | <td> |
||
| 343 | <?=replaceEmpty($data_series[$i]->seriesNumber)?> |
||
| 344 | </td> |
||
| 345 | <?php |
||
| 346 | }?> |
||
| 347 | </tr> |
||
| 348 | <tr> |
||
| 349 | <td>Manufacturer</td> |
||
| 350 | <?php |
||
| 351 | for ($i=0; $i < $series_number; $i++) { |
||
| 352 | ?> |
||
| 353 | <td> |
||
| 354 | <?=replaceEmpty($data_series[$i]->manufacturer)?> |
||
| 355 | </td> |
||
| 356 | <?php |
||
| 357 | }?> |
||
| 358 | </tr> |
||
| 359 | <tr> |
||
| 360 | <td>Series Description</td> |
||
| 361 | <?php |
||
| 362 | for ($i=0; $i < $series_number; $i++) { |
||
| 363 | ?> |
||
| 364 | <td> |
||
| 365 | <?=replaceEmpty($data_series[$i]->seriesDescription)?> |
||
| 366 | </td> |
||
| 367 | <?php |
||
| 368 | } |
||
| 369 | ?> |
||
| 370 | </tr> |
||
| 371 | <tr> |
||
| 372 | <td>Modality</td> |
||
| 373 | <?php |
||
| 374 | for ($i=0; $i < $series_number; $i++) { |
||
| 375 | ?> |
||
| 376 | <td> |
||
| 377 | <?=replaceEmpty($data_series[$i]->modality)?> |
||
| 378 | </td> |
||
| 379 | <?php |
||
| 380 | } |
||
| 381 | ?> |
||
| 382 | </tr> |
||
| 383 | <tr> |
||
| 384 | <td>Acquisition Date Time</td> |
||
| 385 | <?php |
||
| 386 | for ($i=0; $i < $series_number; $i++) { |
||
| 387 | ?> |
||
| 388 | <td> |
||
| 389 | <?=replaceEmpty($data_series[$i]->acquisitionDateTime)?> |
||
| 390 | </td> |
||
| 391 | <?php |
||
| 392 | } |
||
| 393 | ?> |
||
| 394 | </tr> |
||
| 395 | <tr> |
||
| 396 | <td>Total Dose (MBq)</td> |
||
| 397 | <?php |
||
| 398 | for ($i=0; $i < $series_number; $i++) { |
||
| 399 | ?> |
||
| 400 | <td> |
||
| 401 | <?php if (empty($data_series[$i]->injectedDose)) { |
||
| 402 | echo('/'); |
||
| 403 | }else { |
||
| 404 | echo(htmlspecialchars($data_series[$i]->injectedDose/10 ** 6)); |
||
| 405 | } |
||
| 406 | ?> |
||
| 407 | </td> |
||
| 408 | <?php |
||
| 409 | } |
||
| 410 | ?> |
||
| 411 | </tr> |
||
| 412 | <tr> |
||
| 413 | <td>Radiopharmaceutical</td> |
||
| 414 | <?php |
||
| 415 | for ($i=0; $i < $series_number; $i++) { |
||
| 416 | ?> |
||
| 417 | <td> |
||
| 418 | <?=replaceEmpty($data_series[$i]->radiopharmaceutical)?> |
||
| 419 | </td> |
||
| 420 | <?php |
||
| 421 | } |
||
| 422 | ?> |
||
| 423 | </tr> |
||
| 424 | <tr> |
||
| 425 | <td>Injection Date Time</td> |
||
| 426 | <?php |
||
| 427 | for ($i=0; $i < $series_number; $i++) { |
||
| 428 | ?> |
||
| 429 | <td> |
||
| 430 | <?=replaceEmpty($data_series[$i]->injectedDateTime)?> |
||
| 431 | </td> |
||
| 432 | <?php |
||
| 433 | } |
||
| 434 | ?> |
||
| 435 | </tr> |
||
| 436 | <tr> |
||
| 437 | <td>Radiopharm. Specific Activity (MBq)</td> |
||
| 438 | <?php |
||
| 439 | for ($i=0; $i < $series_number; $i++) { |
||
| 440 | ?> |
||
| 441 | <td> |
||
| 442 | <?php if (empty($data_series[$i]->injectedActivity)) { |
||
| 443 | echo('/'); |
||
| 444 | }else { |
||
| 445 | echo(htmlspecialchars($data_series[$i]->injectedActivity/10 ** 6)); |
||
| 446 | } |
||
| 447 | ?> |
||
| 448 | </td> |
||
| 449 | <?php |
||
| 450 | } |
||
| 451 | ?> |
||
| 452 | </tr> |
||
| 453 | <tr> |
||
| 454 | <td>Half Life (s)</td> |
||
| 455 | <?php |
||
| 456 | for ($i=0; $i < $series_number; $i++) { |
||
| 457 | ?> |
||
| 458 | <td> |
||
| 459 | <?=replaceEmpty($data_series[$i]->halfLife)?> |
||
| 460 | </td> |
||
| 461 | <?php |
||
| 462 | } |
||
| 463 | ?> |
||
| 464 | </tr> |
||
| 465 | <tr> |
||
| 466 | <td>Patient's Weight (kg)</td> |
||
| 467 | <?php |
||
| 468 | for ($i=0; $i < $series_number; $i++) { |
||
| 469 | ?> |
||
| 470 | <td> |
||
| 471 | <?=replaceEmpty($data_series[$i]->patientWeight)?> |
||
| 472 | </td> |
||
| 473 | <?php |
||
| 474 | } |
||
| 475 | ?> |
||
| 476 | </tr> |
||
| 477 | <tr> |
||
| 478 | <td>Slice Count</td> |
||
| 479 | <?php |
||
| 480 | for ($i=0; $i < $series_number; $i++) { |
||
| 481 | ?> |
||
| 482 | <td> |
||
| 483 | <?=replaceEmpty($data_series[$i]->numberInstances)?> |
||
| 484 | </td> |
||
| 485 | <?php |
||
| 486 | } |
||
| 487 | ?> |
||
| 488 | </tr> |
||
| 489 | <tr> |
||
| 490 | <td>Upload Date</td> |
||
| 491 | <?php |
||
| 492 | for ($i=0; $i < $series_number; $i++) { |
||
| 493 | ?> |
||
| 494 | <td> |
||
| 495 | <?=replaceEmpty($data_series[$i]->studyDetailsObject->uploadDate)?> |
||
| 496 | </td> |
||
| 497 | <?php |
||
| 498 | } |
||
| 499 | ?> |
||
| 500 | </tr> |
||
| 501 | <?php |
||
| 502 | if (($role == User::INVESTIGATOR || $role == User::CONTROLLER) && ($visitObject->stateQualityControl != Visit::QC_ACCEPTED && $visitObject->stateQualityControl != Visit::QC_REFUSED)) { |
||
| 503 | ?><tr> |
||
| 504 | <td>Delete</td> |
||
| 505 | <?php |
||
| 506 | for ($i=0; $i < $series_number; $i++) { |
||
| 507 | ?> |
||
| 508 | <td> |
||
| 509 | <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> |
||
| 510 | </td> |
||
| 511 | <?php |
||
| 512 | } |
||
| 513 | ?> |
||
| 514 | </tr> |
||
| 515 | <tr> |
||
| 516 | <td colspan="<?=$colspan?>"> |
||
| 517 | <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> |
||
| 518 | </td> |
||
| 519 | </tr> |
||
| 520 | <?php |
||
| 521 | }?> |
||
| 522 | </table> |
||
| 523 | </div> |
||
| 533 | ?> |