Code Duplication    Length = 15-16 lines in 3 locations

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

@@ 286-301 (lines=16) @@
283
     *
284
     * @return array
285
     */
286
    public function prepareRewriteMaps(\SimpleXMLElement $node)
287
    {
288
        $rewriteMaps = array();
289
        if ($node->rewriteMaps) {
290
            foreach ($node->rewriteMaps->rewriteMap as $rewriteMapNode) {
291
                $rewriteMapType = (string)$rewriteMapNode->attributes()->type;
292
                $params = array();
293
                foreach ($rewriteMapNode->params->param as $paramNode) {
294
                    $paramName = (string)$paramNode->attributes()->name;
295
                    $params[$paramName] = (string)array_shift($rewriteMapNode->xpath(".//param[@name='$paramName']"));
296
                }
297
                $rewriteMaps[$rewriteMapType] = $params;
298
            }
299
        }
300
        return $rewriteMaps;
301
    }
302
303
    /**
304
     * Prepares the rewrites array based on a simple xml element node
@@ 397-411 (lines=15) @@
394
     *
395
     * @return array
396
     */
397
    public function prepareAuthentications(\SimpleXMLElement $node)
398
    {
399
        $authentications = array();
400
        if ($node->authentications) {
401
            foreach ($node->authentications->authentication as $authenticationNode) {
402
                $params = array();
403
                foreach ($authenticationNode->params->param as $paramNode) {
404
                    $paramName = (string)$paramNode->attributes()->name;
405
                    $params[$paramName] = (string)array_shift($authenticationNode->xpath(".//param[@name='$paramName']"));
406
                }
407
                $authentications[(string)$authenticationNode->attributes()->uri] = $params;
408
            }
409
        }
410
        return $authentications;
411
    }
412
413
    /**
414
     * Prepares the access array based on a simple xml element node
@@ 420-435 (lines=16) @@
417
     *
418
     * @return array
419
     */
420
    public function prepareAccesses(\SimpleXMLElement $node)
421
    {
422
        // init accesses
423
        $accesses = array();
424
        if ($node->accesses) {
425
            foreach ($node->accesses->access as $accessNode) {
426
                $params = array();
427
                foreach ($accessNode->params->param as $paramNode) {
428
                    $paramName = (string)$paramNode->attributes()->name;
429
                    $params[$paramName] = (string)array_shift($accessNode->xpath(".//param[@name='$paramName']"));
430
                }
431
                $accesses[(string)$accessNode->attributes()->type][] = $params;
432
            }
433
        }
434
        return $accesses;
435
    }
436
437
    /**
438
     * Prepares the analytics array based on a simple XML element node