Code Duplication    Length = 20-25 lines in 2 locations

core/diag/Telepath.php 2 locations

@@ 330-354 (lines=25) @@
327
        //   is guilty. If that one fails, the direct monitoring of servers and ETLRs themselves
328
        //   closes the loop.
329
        // let's see if the ETLRs are up
330
        if (array_key_exists(AbstractTest::INFRA_ETLR, $this->possibleFailureReasons)) {
331
332
            $etlrStatus = $this->checkEtlrStatus();
333
            $this->additionalFindings[AbstractTest::INFRA_ETLR][] = $etlrStatus;
334
            switch ($etlrStatus["STATUS"]) {
335
                case AbstractTest::STATUS_GOOD:
336
                    unset($this->possibleFailureReasons[AbstractTest::INFRA_ETLR]);
337
                    break;
338
                case AbstractTest::STATUS_PARTIAL:
339
                case AbstractTest::STATUS_MONITORINGFAIL:
340
                    // one of the ETLRs is down, or there is a failure in the monitoring system? 
341
                    // This probably doesn't impact the user unless he's unlucky and has his session fall into failover.
342
                    // keep ETLR as a possible problem with original probability
343
                    break;
344
                case AbstractTest::STATUS_DOWN:
345
                    // Oh! Well if it is not international roaming, that still doesn't have an effect /in this case/. 
346
                    if ($this->idPFederation == $this->visitedFlr) {
347
                        unset($this->possibleFailureReasons[AbstractTest::INFRA_ETLR]);
348
                        break;
349
                    }
350
                    // But it is about int'l roaming, and we are spot on here.
351
                    // Raise probability by much (even monitoring is sometimes wrong, or a few minutes behind reality)
352
                    $this->possibleFailureReasons[AbstractTest::INFRA_ETLR] = 0.95;
353
            }
354
        }
355
356
        // then let's check the IdP's FLR, if we know the IdP federation at all
357
        if ($this->idPFederation != NULL) {
@@ 377-396 (lines=20) @@
374
            }
375
376
            // now let's theck the link
377
            if (array_key_exists(AbstractTest::INFRA_LINK_ETLR_NRO_IDP, $this->possibleFailureReasons)) {
378
                $flrUplinkStatus = $this->checkFedEtlrUplink($this->idPFederation);
379
                $this->additionalFindings[AbstractTest::INFRA_NRO_IDP][] = $flrUplinkStatus;
380
                switch ($flrUplinkStatus["STATUS"]) {
381
                    case AbstractTest::STATUS_GOOD:
382
                        unset($this->possibleFailureReasons[AbstractTest::INFRA_NRO_IDP]);
383
                        unset($this->possibleFailureReasons[AbstractTest::INFRA_LINK_ETLR_NRO_IDP]);
384
                        break;
385
                    case AbstractTest::STATUS_PARTIAL:
386
                        // 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.
387
                        // keep FLR as a possible problem with original probability
388
                        break;
389
                    case AbstractTest::STATUS_DOWN:
390
                        // Raise probability by much (even monitoring is sometimes wrong, or a few minutes behind reality)
391
                        // if earlier test found the server itself to be the problem, keep it, otherwise put the blame on the link
392
                        if ($this->possibleFailureReasons[AbstractTest::INFRA_NRO_IDP] != 0.95) {
393
                            $this->possibleFailureReasons[AbstractTest::INFRA_LINK_ETLR_NRO_IDP] = 0.95;
394
                        }
395
                }
396
            }
397
        }
398
        // now, if we know the country the user is currently in, let's see 
399
        // if the NRO SP-side is up