Code Duplication    Length = 20-25 lines in 2 locations

core/diag/Telepath.php 2 locations

@@ 308-332 (lines=25) @@
305
        //   is guilty. If that one fails, the direct monitoring of servers and ETLRs themselves
306
        //   closes the loop.
307
        // let's see if the ETLRs are up
308
        if (array_key_exists(AbstractTest::INFRA_ETLR, $this->possibleFailureReasons)) {
309
310
            $etlrStatus = $this->checkEtlrStatus();
311
            $this->additionalFindings[AbstractTest::INFRA_ETLR][] = $etlrStatus;
312
            switch ($etlrStatus["STATUS"]) {
313
                case AbstractTest::STATUS_GOOD:
314
                    unset($this->possibleFailureReasons[AbstractTest::INFRA_ETLR]);
315
                    break;
316
                case AbstractTest::STATUS_PARTIAL:
317
                case AbstractTest::STATUS_MONITORINGFAIL:
318
                    // one of the ETLRs is down, or there is a failure in the monitoring system? 
319
                    // This probably doesn't impact the user unless he's unlucky and has his session fall into failover.
320
                    // keep ETLR as a possible problem with original probability
321
                    break;
322
                case AbstractTest::STATUS_DOWN:
323
                    // Oh! Well if it is not international roaming, that still doesn't have an effect /in this case/. 
324
                    if ($this->idPFederation == $this->visitedFlr) {
325
                        unset($this->possibleFailureReasons[AbstractTest::INFRA_ETLR]);
326
                        break;
327
                    }
328
                    // But it is about int'l roaming, and we are spot on here.
329
                    // Raise probability by much (even monitoring is sometimes wrong, or a few minutes behind reality)
330
                    $this->possibleFailureReasons[AbstractTest::INFRA_ETLR] = 0.95;
331
            }
332
        }
333
334
        // then let's check the IdP's FLR, if we know the IdP federation at all
335
        if ($this->idPFederation != NULL) {
@@ 355-374 (lines=20) @@
352
            }
353
354
            // now let's theck the link
355
            if (array_key_exists(AbstractTest::INFRA_LINK_ETLR_NRO_IDP, $this->possibleFailureReasons)) {
356
                $flrUplinkStatus = $this->checkFedEtlrUplink($this->idPFederation);
357
                $this->additionalFindings[AbstractTest::INFRA_NRO_IDP][] = $flrUplinkStatus;
358
                switch ($flrUplinkStatus["STATUS"]) {
359
                    case AbstractTest::STATUS_GOOD:
360
                        unset($this->possibleFailureReasons[AbstractTest::INFRA_NRO_IDP]);
361
                        unset($this->possibleFailureReasons[AbstractTest::INFRA_LINK_ETLR_NRO_IDP]);
362
                        break;
363
                    case AbstractTest::STATUS_PARTIAL:
364
                        // 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.
365
                        // keep FLR as a possible problem with original probability
366
                        break;
367
                    case AbstractTest::STATUS_DOWN:
368
                        // Raise probability by much (even monitoring is sometimes wrong, or a few minutes behind reality)
369
                        // if earlier test found the server itself to be the problem, keep it, otherwise put the blame on the link
370
                        if ($this->possibleFailureReasons[AbstractTest::INFRA_NRO_IDP] != 0.95) {
371
                            $this->possibleFailureReasons[AbstractTest::INFRA_LINK_ETLR_NRO_IDP] = 0.95;
372
                        }
373
                }
374
            }
375
        }
376
        // now, if we know the country the user is currently in, let's see 
377
        // if the NRO SP-side is up