Code Duplication    Length = 18-18 lines in 2 locations

core/diag/Telepath.php 2 locations

@@ 352-369 (lines=18) @@
349
            }
350
            // then its uplink 
351
            $flrUplinkStatus = $this->checkFedEtlrUplink($this->idPFederation);
352
            switch ($flrUplinkStatus) {
353
                case Telepath::STATUS_GOOD:
354
                    $this->additionalFindings[Telepath::INFRA_NRO_IDP][] = ["STATUS" => Telepath::STATUS_GOOD];
355
                    $this->possibleFailureReasons = array_diff($this->possibleFailureReasons, [Telepath::INFRA_NRO_IDP, Telepath::INFRA_LINK_ETLR_NRO_IDP]);
356
                    break;
357
                case Telepath::STATUS_PARTIAL:
358
                    // a subset of the FLRs is down? This probably doesn't impact the user unless he's unlucky and has his session fall into failover.
359
                    // keep FLR as a possible problem with original probability
360
                    $this->additionalFindings[Telepath::INFRA_NRO_IDP][] = ["STATUS" => Telepath::STATUS_PARTIAL];
361
                    break;
362
                case Telepath::STATUS_DOWN:
363
                    $this->additionalFindings[Telepath::INFRA_NRO_IDP][] = ["STATUS" => Telepath::STATUS_DOWN];
364
                    // Raise probability by much (even monitoring is sometimes wrong, or a few minutes behind reality)
365
                    // if earlier test found the server itself to be the problem, keep it, otherwise put the blame on the link
366
                    if ($this->probabilities[Telepath::INFRA_NRO_IDP] != 0.95) {
367
                        $this->probabilities[Telepath::INFRA_LINK_ETLR_NRO_IDP] = 0.95;
368
                    }
369
            }
370
        }
371
372
        // now, if we know the country the user is currently in, let's see 
@@ 394-411 (lines=18) @@
391
            }
392
            // and again its uplink to the ETLR
393
            $visitedFlrUplinkStatus = $this->checkFedEtlrUplink($this->visitedFlr);
394
            switch ($visitedFlrUplinkStatus) {
395
                case Telepath::STATUS_GOOD:
396
                    $this->additionalFindings[Telepath::INFRA_NRO_SP][] = ["STATUS" => Telepath::STATUS_GOOD];
397
                    $this->possibleFailureReasons = array_diff($this->possibleFailureReasons, [Telepath::INFRA_NRO_SP, Telepath::INFRA_LINK_ETLR_NRO_SP]);
398
                    break;
399
                case Telepath::STATUS_PARTIAL:
400
                    // a subset of the FLRs is down? This probably doesn't impact the user unless he's unlucky and has his session fall into failover.
401
                    // keep FLR as a possible problem with original probability
402
                    $this->additionalFindings[Telepath::INFRA_NRO_SP][] = ["STATUS" => Telepath::STATUS_PARTIAL];
403
                    break;
404
                case Telepath::STATUS_DOWN:
405
                    $this->additionalFindings[Telepath::INFRA_NRO_SP][] = ["STATUS" => Telepath::STATUS_DOWN];
406
                    // Raise probability by much (even monitoring is sometimes wrong, or a few minutes behind reality)
407
                    // if earlier test found the server itself to be the problem, keep it, otherwise put the blame on the link
408
                    if ($this->probabilities[Telepath::INFRA_NRO_SP] != 0.95) {
409
                        $this->probabilities[Telepath::INFRA_LINK_ETLR_NRO_SP] = 0.95;
410
                    }
411
            }
412
            // the last thing we can do (but it's a bit redundant): check the country-to-country link
413
            // it's only needed if all three and their links are up, but we want to exclude funny routing blacklists 
414
            // which occur only in the *combination* of source and dest