Code Duplication    Length = 15-16 lines in 3 locations

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

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