Code Duplication    Length = 27-27 lines in 2 locations

Alpha/Model/ActiveRecordProviderMySQL.php 1 location

@@ 1573-1599 (lines=27) @@
1570
     *
1571
     * @see Alpha\Model\ActiveRecordProviderInterface::getMAX()
1572
     */
1573
    public function getMAX()
1574
    {
1575
        self::$logger->debug('>>getMAX()');
1576
1577
        $sqlQuery = 'SELECT MAX(OID) AS max_OID FROM '.$this->BO->getTableName();
1578
1579
        $this->BO->setLastQuery($sqlQuery);
1580
1581
        try {
1582
            $result = $this->BO->query($sqlQuery);
1583
1584
            $row = $result[0];
1585
1586
            if (isset($row['max_OID'])) {
1587
                self::$logger->debug('<<getMAX ['.$row['max_OID'].']');
1588
1589
                return $row['max_OID'];
1590
            } else {
1591
                throw new AlphaException('Failed to get the MAX ID for the class ['.get_class($this->BO).'] from the table ['.$this->BO->getTableName().'], query is ['.$this->BO->getLastQuery().']');
1592
            }
1593
        } catch (\Exception $e) {
1594
            throw new AlphaException($e->getMessage());
1595
            self::$logger->debug('<<getMAX [0]');
1596
1597
            return 0;
1598
        }
1599
    }
1600
1601
    /**
1602
     * (non-PHPdoc).

Alpha/Model/ActiveRecordProviderSQLite.php 1 location

@@ 1626-1652 (lines=27) @@
1623
     *
1624
     * @see Alpha\Model\ActiveRecordProviderInterface::getMAX()
1625
     */
1626
    public function getMAX()
1627
    {
1628
        self::$logger->debug('>>getMAX()');
1629
1630
        $sqlQuery = 'SELECT MAX(OID) AS max_OID FROM '.$this->BO->getTableName();
1631
1632
        $this->BO->setLastQuery($sqlQuery);
1633
1634
        try {
1635
            $result = $this->BO->query($sqlQuery);
1636
1637
            $row = $result[0];
1638
1639
            if (isset($row['max_OID'])) {
1640
                self::$logger->debug('<<getMAX ['.$row['max_OID'].']');
1641
1642
                return $row['max_OID'];
1643
            } else {
1644
                throw new AlphaException('Failed to get the MAX ID for the class ['.get_class($this->BO).'] from the table ['.$this->BO->getTableName().'], query is ['.$this->BO->getLastQuery().']');
1645
            }
1646
        } catch (Exception $e) {
1647
            throw new AlphaException($e->getMessage());
1648
            self::$logger->debug('<<getMAX [0]');
1649
1650
            return 0;
1651
        }
1652
    }
1653
1654
    /**
1655
     * (non-PHPdoc).