Code Duplication    Length = 16-17 lines in 3 locations

src/AppserverIo/Server/Configuration/ServerXmlConfiguration.php 3 locations

@@ 551-567 (lines=17) @@
548
     *
549
     * @return array
550
     */
551
    public function prepareRewriteMaps(\SimpleXMLElement $node)
552
    {
553
        $rewriteMaps = array();
554
        if ($node->rewriteMaps) {
555
            foreach ($node->rewriteMaps->rewriteMap as $rewriteMapNode) {
556
                $rewriteMapType = (string)$rewriteMapNode->attributes()->type;
557
                $params = array();
558
                foreach ($rewriteMapNode->params->param as $paramNode) {
559
                    $paramName = (string) $paramNode->attributes()->name;
560
                    $paramNodes = $rewriteMapNode->xpath(".//param[@name='$paramName']");
561
                    $params[$paramName] = (string) array_shift($paramNodes);
562
                }
563
                $rewriteMaps[$rewriteMapType] = $params;
564
            }
565
        }
566
        return $rewriteMaps;
567
    }
568
569
    /**
570
     * Prepares the rewrites array based on a simple xml element node
@@ 663-678 (lines=16) @@
660
     *
661
     * @return array
662
     */
663
    public function prepareAuthentications(\SimpleXMLElement $node)
664
    {
665
        $authentications = array();
666
        if ($node->authentications) {
667
            foreach ($node->authentications->authentication as $authenticationNode) {
668
                $params = array();
669
                foreach ($authenticationNode->params->param as $paramNode) {
670
                    $paramName = (string) $paramNode->attributes()->name;
671
                    $paramNodes = $authenticationNode->xpath(".//param[@name='$paramName']");
672
                    $params[$paramName] = (string) array_shift($paramNodes);
673
                }
674
                $authentications[(string)$authenticationNode->attributes()->uri] = $params;
675
            }
676
        }
677
        return $authentications;
678
    }
679
680
    /**
681
     * Prepares the access array based on a simple xml element node
@@ 687-703 (lines=17) @@
684
     *
685
     * @return array
686
     */
687
    public function prepareAccesses(\SimpleXMLElement $node)
688
    {
689
        // init accesses
690
        $accesses = array();
691
        if ($node->accesses) {
692
            foreach ($node->accesses->access as $accessNode) {
693
                $params = array();
694
                foreach ($accessNode->params->param as $paramNode) {
695
                    $paramName = (string)$paramNode->attributes()->name;
696
                    $paramNodes = $accessNode->xpath(".//param[@name='$paramName']");
697
                    $params[$paramName] = (string) array_shift($paramNodes);
698
                }
699
                $accesses[(string) $accessNode->attributes()->type][] = $params;
700
            }
701
        }
702
        return $accesses;
703
    }
704
705
    /**
706
     * Prepares the analytics array based on a simple XML element node