Code Duplication    Length = 16-17 lines in 3 locations

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

@@ 565-581 (lines=17) @@
562
     *
563
     * @return array
564
     */
565
    public function prepareRewriteMaps(\SimpleXMLElement $node)
566
    {
567
        $rewriteMaps = array();
568
        if ($node->rewriteMaps) {
569
            foreach ($node->rewriteMaps->rewriteMap as $rewriteMapNode) {
570
                $rewriteMapType = (string)$rewriteMapNode->attributes()->type;
571
                $params = array();
572
                foreach ($rewriteMapNode->params->param as $paramNode) {
573
                    $paramName = (string) $paramNode->attributes()->name;
574
                    $paramNodes = $rewriteMapNode->xpath(".//param[@name='$paramName']");
575
                    $params[$paramName] = (string) array_shift($paramNodes);
576
                }
577
                $rewriteMaps[$rewriteMapType] = $params;
578
            }
579
        }
580
        return $rewriteMaps;
581
    }
582
583
    /**
584
     * Prepares the rewrites array based on a simple xml element node
@@ 677-692 (lines=16) @@
674
     *
675
     * @return array
676
     */
677
    public function prepareAuthentications(\SimpleXMLElement $node)
678
    {
679
        $authentications = array();
680
        if ($node->authentications) {
681
            foreach ($node->authentications->authentication as $authenticationNode) {
682
                $params = array();
683
                foreach ($authenticationNode->params->param as $paramNode) {
684
                    $paramName = (string) $paramNode->attributes()->name;
685
                    $paramNodes = $authenticationNode->xpath(".//param[@name='$paramName']");
686
                    $params[$paramName] = (string) array_shift($paramNodes);
687
                }
688
                $authentications[(string)$authenticationNode->attributes()->uri] = $params;
689
            }
690
        }
691
        return $authentications;
692
    }
693
694
    /**
695
     * Prepares the access array based on a simple xml element node
@@ 701-717 (lines=17) @@
698
     *
699
     * @return array
700
     */
701
    public function prepareAccesses(\SimpleXMLElement $node)
702
    {
703
        // init accesses
704
        $accesses = array();
705
        if ($node->accesses) {
706
            foreach ($node->accesses->access as $accessNode) {
707
                $params = array();
708
                foreach ($accessNode->params->param as $paramNode) {
709
                    $paramName = (string)$paramNode->attributes()->name;
710
                    $paramNodes = $accessNode->xpath(".//param[@name='$paramName']");
711
                    $params[$paramName] = (string) array_shift($paramNodes);
712
                }
713
                $accesses[(string) $accessNode->attributes()->type][] = $params;
714
            }
715
        }
716
        return $accesses;
717
    }
718
719
    /**
720
     * Prepares the analytics array based on a simple XML element node