Code Duplication    Length = 25-27 lines in 2 locations

Alpha/Model/ActiveRecordProviderMySQL.php 1 location

@@ 1576-1602 (lines=27) @@
1573
     *
1574
     * @see Alpha\Model\ActiveRecordProviderInterface::getMAX()
1575
     */
1576
    public function getMAX()
1577
    {
1578
        self::$logger->debug('>>getMAX()');
1579
1580
        $sqlQuery = 'SELECT MAX(OID) AS max_OID FROM '.$this->BO->getTableName();
1581
1582
        $this->BO->setLastQuery($sqlQuery);
1583
1584
        try {
1585
            $result = $this->BO->query($sqlQuery);
1586
1587
            $row = $result[0];
1588
1589
            if (isset($row['max_OID'])) {
1590
                self::$logger->debug('<<getMAX ['.$row['max_OID'].']');
1591
1592
                return $row['max_OID'];
1593
            } else {
1594
                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().']');
1595
            }
1596
        } catch (\Exception $e) {
1597
            throw new AlphaException($e->getMessage());
1598
            self::$logger->debug('<<getMAX [0]');
1599
1600
            return 0;
1601
        }
1602
    }
1603
1604
    /**
1605
     * (non-PHPdoc).

Alpha/Model/ActiveRecordProviderSQLite.php 1 location

@@ 1594-1618 (lines=25) @@
1591
     *
1592
     * @see Alpha\Model\ActiveRecordProviderInterface::getMAX()
1593
     */
1594
    public function getMAX()
1595
    {
1596
        self::$logger->debug('>>getMAX()');
1597
1598
        $sqlQuery = 'SELECT MAX(OID) AS max_OID FROM '.$this->BO->getTableName();
1599
1600
        $this->BO->setLastQuery($sqlQuery);
1601
1602
        try {
1603
            $result = $this->BO->query($sqlQuery);
1604
1605
            $row = $result[0];
1606
1607
            if (isset($row['max_OID'])) {
1608
                self::$logger->debug('<<getMAX ['.$row['max_OID'].']');
1609
1610
                return $row['max_OID'];
1611
            } else {
1612
                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().']');
1613
            }
1614
        } catch (Exception $e) {
1615
            self::$logger->debug('<<getMAX');
1616
            throw new AlphaException($e->getMessage());
1617
        }
1618
    }
1619
1620
    /**
1621
     * (non-PHPdoc).