Code Duplication    Length = 38-38 lines in 2 locations

debian/flexipeehp/usr/share/php/FlexiPeeHP/FlexiBeeRO.php 1 location

@@ 1454-1491 (lines=38) @@
1451
     *
1452
     * @return array
1453
     */
1454
    public function getColumnsFromFlexibee($columnsList, $conditions = [],
1455
                                           $indexBy = null)
1456
    {
1457
        $detail = 'full';
1458
        switch (gettype($columnsList)) {
1459
            case 'integer': //Record ID
1460
                $conditions = [$this->getmyKeyColumn() => $conditions];
1461
            case 'array': //Few Conditions
1462
                if (!is_null($indexBy) && !array_key_exists($indexBy,
1463
                        $columnsList)) {
1464
                    $columnsList[] = $indexBy;
1465
                }
1466
                $columns = implode(',', array_unique($columnsList));
1467
                $detail  = 'custom:'.$columns;
1468
            default:
1469
                switch ($columnsList) {
1470
                    case 'id':
1471
                        $detail = 'id';
1472
                        break;
1473
                    case 'summary':
1474
                        $detail = 'summary';
1475
                        break;
1476
                    default:
1477
                        break;
1478
                }
1479
                break;
1480
        }
1481
1482
        $conditions['detail'] = $detail;
1483
1484
        $flexiData = $this->getFlexiData(null, $conditions);
1485
1486
        if (!is_null($indexBy) && count($flexiData) && count(current($flexiData))) {
1487
            $flexiData = $this->reindexArrayBy($flexiData, $indexBy);
1488
        }
1489
1490
        return $flexiData;
1491
    }
1492
1493
    /**
1494
     * Vrací kód záznamu.

src/FlexiPeeHP/FlexiBeeRO.php 1 location

@@ 1482-1519 (lines=38) @@
1479
     *
1480
     * @return array
1481
     */
1482
    public function getColumnsFromFlexibee($columnsList, $conditions = [],
1483
                                           $indexBy = null)
1484
    {
1485
        $detail = 'full';
1486
        switch (gettype($columnsList)) {
1487
            case 'integer': //Record ID
1488
                $conditions = [$this->getmyKeyColumn() => $conditions];
1489
            case 'array': //Few Conditions
1490
                if (!is_null($indexBy) && !array_key_exists($indexBy,
1491
                        $columnsList)) {
1492
                    $columnsList[] = $indexBy;
1493
                }
1494
                $columns = implode(',', array_unique($columnsList));
1495
                $detail  = 'custom:'.$columns;
1496
            default:
1497
                switch ($columnsList) {
1498
                    case 'id':
1499
                        $detail = 'id';
1500
                        break;
1501
                    case 'summary':
1502
                        $detail = 'summary';
1503
                        break;
1504
                    default:
1505
                        break;
1506
                }
1507
                break;
1508
        }
1509
1510
        $conditions['detail'] = $detail;
1511
1512
        $flexiData = $this->getFlexiData(null, $conditions);
1513
1514
        if (is_array($indexBy) && count($flexiData) && count(current($flexiData))) {
1515
            $flexiData = $this->reindexArrayBy($flexiData, $indexBy);
1516
        }
1517
1518
        return $flexiData;
1519
    }
1520
1521
    /**
1522
     * Vrací kód záznamu.