Code Duplication    Length = 24-26 lines in 8 locations

typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php 8 locations

@@ 1331-1354 (lines=24) @@
1328
        }
1329
        // Prepare IFSUB settings, overriding normal settings
1330
        // IFSUB is TRUE if there exist submenu items to the current item
1331
        if (!empty($this->mconf['IFSUB'])) {
1332
            $IFSUBconf = null;
1333
            $IFSUBROconf = null;
1334
            foreach ($NOconf as $key => $val) {
1335
                if ($this->isItemState('IFSUB', $key)) {
1336
                    // if this is the first IFSUB element, we must generate IFSUB.
1337
                    if ($IFSUBconf === null) {
1338
                        $IFSUBconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['IFSUB.'], $splitCount);
1339
                        if (!empty($this->mconf['IFSUBRO'])) {
1340
                            $IFSUBROconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['IFSUBRO.'], $splitCount);
1341
                        }
1342
                    }
1343
                    // Substitute normal with ifsub
1344
                    if (isset($IFSUBconf[$key])) {
1345
                        $NOconf[$key] = $IFSUBconf[$key];
1346
                    }
1347
                    // If rollOver on normal, we must apply a state for rollOver on the active
1348
                    if ($ROconf) {
1349
                        // If RollOver on active then apply this
1350
                        $ROconf[$key] = !empty($IFSUBROconf[$key]) ? $IFSUBROconf[$key] : $IFSUBconf[$key];
1351
                    }
1352
                }
1353
            }
1354
        }
1355
        // Prepare active settings, overriding normal settings
1356
        if (!empty($this->mconf['ACT'])) {
1357
            $ACTconf = null;
@@ 1356-1381 (lines=26) @@
1353
            }
1354
        }
1355
        // Prepare active settings, overriding normal settings
1356
        if (!empty($this->mconf['ACT'])) {
1357
            $ACTconf = null;
1358
            $ACTROconf = null;
1359
            // Find active
1360
            foreach ($NOconf as $key => $val) {
1361
                if ($this->isItemState('ACT', $key)) {
1362
                    // If this is the first 'active', we must generate ACT.
1363
                    if ($ACTconf === null) {
1364
                        $ACTconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['ACT.'], $splitCount);
1365
                        // Prepare active rollOver settings, overriding normal active settings
1366
                        if (!empty($this->mconf['ACTRO'])) {
1367
                            $ACTROconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['ACTRO.'], $splitCount);
1368
                        }
1369
                    }
1370
                    // Substitute normal with active
1371
                    if (isset($ACTconf[$key])) {
1372
                        $NOconf[$key] = $ACTconf[$key];
1373
                    }
1374
                    // If rollOver on normal, we must apply a state for rollOver on the active
1375
                    if ($ROconf) {
1376
                        // If RollOver on active then apply this
1377
                        $ROconf[$key] = !empty($ACTROconf[$key]) ? $ACTROconf[$key] : $ACTconf[$key];
1378
                    }
1379
                }
1380
            }
1381
        }
1382
        // Prepare ACT (active)/IFSUB settings, overriding normal settings
1383
        // ACTIFSUB is TRUE if there exist submenu items to the current item and the current item is active
1384
        if (!empty($this->mconf['ACTIFSUB'])) {
@@ 1384-1409 (lines=26) @@
1381
        }
1382
        // Prepare ACT (active)/IFSUB settings, overriding normal settings
1383
        // ACTIFSUB is TRUE if there exist submenu items to the current item and the current item is active
1384
        if (!empty($this->mconf['ACTIFSUB'])) {
1385
            $ACTIFSUBconf = null;
1386
            $ACTIFSUBROconf = null;
1387
            // Find active
1388
            foreach ($NOconf as $key => $val) {
1389
                if ($this->isItemState('ACTIFSUB', $key)) {
1390
                    // If this is the first 'active', we must generate ACTIFSUB.
1391
                    if ($ACTIFSUBconf === null) {
1392
                        $ACTIFSUBconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['ACTIFSUB.'], $splitCount);
1393
                        // Prepare active rollOver settings, overriding normal active settings
1394
                        if (!empty($this->mconf['ACTIFSUBRO'])) {
1395
                            $ACTIFSUBROconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['ACTIFSUBRO.'], $splitCount);
1396
                        }
1397
                    }
1398
                    // Substitute normal with active
1399
                    if (isset($ACTIFSUBconf[$key])) {
1400
                        $NOconf[$key] = $ACTIFSUBconf[$key];
1401
                    }
1402
                    // If rollOver on normal, we must apply a state for rollOver on the active
1403
                    if ($ROconf) {
1404
                        // If RollOver on active then apply this
1405
                        $ROconf[$key] = !empty($ACTIFSUBROconf[$key]) ? $ACTIFSUBROconf[$key] : $ACTIFSUBconf[$key];
1406
                    }
1407
                }
1408
            }
1409
        }
1410
        // Prepare CUR (current) settings, overriding normal settings
1411
        // CUR is TRUE if the current page equals the item here!
1412
        if (!empty($this->mconf['CUR'])) {
@@ 1412-1437 (lines=26) @@
1409
        }
1410
        // Prepare CUR (current) settings, overriding normal settings
1411
        // CUR is TRUE if the current page equals the item here!
1412
        if (!empty($this->mconf['CUR'])) {
1413
            $CURconf = null;
1414
            $CURROconf = null;
1415
            foreach ($NOconf as $key => $val) {
1416
                if ($this->isItemState('CUR', $key)) {
1417
                    // if this is the first 'current', we must generate CUR. Basically this control is just inherited
1418
                    // from the other implementations as current would only exist one time and that's it
1419
                    // (unless you use special-features of HMENU)
1420
                    if ($CURconf === null) {
1421
                        $CURconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['CUR.'], $splitCount);
1422
                        if (!empty($this->mconf['CURRO'])) {
1423
                            $CURROconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['CURRO.'], $splitCount);
1424
                        }
1425
                    }
1426
                    // Substitute normal with current
1427
                    if (isset($CURconf[$key])) {
1428
                        $NOconf[$key] = $CURconf[$key];
1429
                    }
1430
                    // If rollOver on normal, we must apply a state for rollOver on the active
1431
                    if ($ROconf) {
1432
                        // If RollOver on active then apply this
1433
                        $ROconf[$key] = !empty($CURROconf[$key]) ? $CURROconf[$key] : $CURconf[$key];
1434
                    }
1435
                }
1436
            }
1437
        }
1438
        // Prepare CUR (current)/IFSUB settings, overriding normal settings
1439
        // CURIFSUB is TRUE if there exist submenu items to the current item and the current page equals the item here!
1440
        if (!empty($this->mconf['CURIFSUB'])) {
@@ 1440-1464 (lines=25) @@
1437
        }
1438
        // Prepare CUR (current)/IFSUB settings, overriding normal settings
1439
        // CURIFSUB is TRUE if there exist submenu items to the current item and the current page equals the item here!
1440
        if (!empty($this->mconf['CURIFSUB'])) {
1441
            $CURIFSUBconf = null;
1442
            $CURIFSUBROconf = null;
1443
            foreach ($NOconf as $key => $val) {
1444
                if ($this->isItemState('CURIFSUB', $key)) {
1445
                    // If this is the first 'current', we must generate CURIFSUB.
1446
                    if ($CURIFSUBconf === null) {
1447
                        $CURIFSUBconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['CURIFSUB.'], $splitCount);
1448
                        // Prepare current rollOver settings, overriding normal current settings
1449
                        if (!empty($this->mconf['CURIFSUBRO'])) {
1450
                            $CURIFSUBROconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['CURIFSUBRO.'], $splitCount);
1451
                        }
1452
                    }
1453
                    // Substitute normal with active
1454
                    if ($CURIFSUBconf[$key]) {
1455
                        $NOconf[$key] = $CURIFSUBconf[$key];
1456
                    }
1457
                    // If rollOver on normal, we must apply a state for rollOver on the current
1458
                    if ($ROconf) {
1459
                        // If RollOver on current then apply this
1460
                        $ROconf[$key] = !empty($CURIFSUBROconf[$key]) ? $CURIFSUBROconf[$key] : $CURIFSUBconf[$key];
1461
                    }
1462
                }
1463
            }
1464
        }
1465
        // Prepare active settings, overriding normal settings
1466
        if (!empty($this->mconf['USR'])) {
1467
            $USRconf = null;
@@ 1466-1491 (lines=26) @@
1463
            }
1464
        }
1465
        // Prepare active settings, overriding normal settings
1466
        if (!empty($this->mconf['USR'])) {
1467
            $USRconf = null;
1468
            $USRROconf = null;
1469
            // Find active
1470
            foreach ($NOconf as $key => $val) {
1471
                if ($this->isItemState('USR', $key)) {
1472
                    // if this is the first active, we must generate USR.
1473
                    if ($USRconf === null) {
1474
                        $USRconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['USR.'], $splitCount);
1475
                        // Prepare active rollOver settings, overriding normal active settings
1476
                        if (!empty($this->mconf['USRRO'])) {
1477
                            $USRROconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['USRRO.'], $splitCount);
1478
                        }
1479
                    }
1480
                    // Substitute normal with active
1481
                    if ($USRconf[$key]) {
1482
                        $NOconf[$key] = $USRconf[$key];
1483
                    }
1484
                    // If rollOver on normal, we must apply a state for rollOver on the active
1485
                    if ($ROconf) {
1486
                        // If RollOver on active then apply this
1487
                        $ROconf[$key] = !empty($USRROconf[$key]) ? $USRROconf[$key] : $USRconf[$key];
1488
                    }
1489
                }
1490
            }
1491
        }
1492
        // Prepare spacer settings, overriding normal settings
1493
        if (!empty($this->mconf['SPC'])) {
1494
            $SPCconf = null;
@@ 1510-1535 (lines=26) @@
1507
            }
1508
        }
1509
        // Prepare Userdefined settings
1510
        if (!empty($this->mconf['USERDEF1'])) {
1511
            $USERDEF1conf = null;
1512
            $USERDEF1ROconf = null;
1513
            // Find active
1514
            foreach ($NOconf as $key => $val) {
1515
                if ($this->isItemState('USERDEF1', $key)) {
1516
                    // If this is the first active, we must generate USERDEF1.
1517
                    if ($USERDEF1conf === null) {
1518
                        $USERDEF1conf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['USERDEF1.'], $splitCount);
1519
                        // Prepare active rollOver settings, overriding normal active settings
1520
                        if (!empty($this->mconf['USERDEF1RO'])) {
1521
                            $USERDEF1ROconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['USERDEF1RO.'], $splitCount);
1522
                        }
1523
                    }
1524
                    // Substitute normal with active
1525
                    if (isset($USERDEF1conf[$key])) {
1526
                        $NOconf[$key] = $USERDEF1conf[$key];
1527
                    }
1528
                    // If rollOver on normal, we must apply a state for rollOver on the active
1529
                    if ($ROconf) {
1530
                        // If RollOver on active then apply this
1531
                        $ROconf[$key] = !empty($USERDEF1ROconf[$key]) ? $USERDEF1ROconf[$key] : $USERDEF1conf[$key];
1532
                    }
1533
                }
1534
            }
1535
        }
1536
        // Prepare Userdefined settings
1537
        if (!empty($this->mconf['USERDEF2'])) {
1538
            $USERDEF2conf = null;
@@ 1537-1562 (lines=26) @@
1534
            }
1535
        }
1536
        // Prepare Userdefined settings
1537
        if (!empty($this->mconf['USERDEF2'])) {
1538
            $USERDEF2conf = null;
1539
            $USERDEF2ROconf = null;
1540
            // Find active
1541
            foreach ($NOconf as $key => $val) {
1542
                if ($this->isItemState('USERDEF2', $key)) {
1543
                    // If this is the first active, we must generate USERDEF2.
1544
                    if ($USERDEF2conf === null) {
1545
                        $USERDEF2conf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['USERDEF2.'], $splitCount);
1546
                        // Prepare active rollOver settings, overriding normal active settings
1547
                        if (!empty($this->mconf['USERDEF2RO'])) {
1548
                            $USERDEF2ROconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['USERDEF2RO.'], $splitCount);
1549
                        }
1550
                    }
1551
                    // Substitute normal with active
1552
                    if (isset($USERDEF2conf[$key])) {
1553
                        $NOconf[$key] = $USERDEF2conf[$key];
1554
                    }
1555
                    // If rollOver on normal, we must apply a state for rollOver on the active
1556
                    if ($ROconf) {
1557
                        // If RollOver on active then apply this
1558
                        $ROconf[$key] = !empty($USERDEF2ROconf[$key]) ? $USERDEF2ROconf[$key] : $USERDEF2conf[$key];
1559
                    }
1560
                }
1561
            }
1562
        }
1563
        return [$NOconf, $ROconf];
1564
    }
1565