Completed
Push — master ( 10fc3d...cbc6e7 )
by Richard
14s
created

XoopsMySQLDatabaseProxy   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 16 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 4
loc 25
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A query() 0 9 3

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * You may not change or alter any portion of this comment or credits
4
 * of supporting developers from this source code or any supporting source code
5
 * which is considered copyrighted (c) material of the original comment or credit authors.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
 */
11
12
/**
13
 * Read-Only connection to a MySQL database.
14
 *
15
 * This class allows only SELECT queries to be performed through its
16
 * query() method for security reasons.
17
 *
18
 * PHP version 5.3
19
 *
20
 * @category   Xoops\Class\Database\MySQLDatabaseProxy
21
 * @package    MySQLDatabaseProxy
22
 * @author     Kazumi Ono <[email protected]>
23
 * @author     readheadedrod <[email protected]>
24
 * @author     Richard Griffith <[email protected]>
25
 * @copyright  2013 XOOPS Project (http://xoops.org)
26
 * @license    GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
27
 * @version    Release: 2.6
28
 * @link       http://xoops.org
29
 * @since      2.6.0
30
 * @deprecated since version 2.6.0 - alpha 3. Switch to doctrine connector.
31
 */
32
33
class XoopsMySQLDatabaseProxy extends XoopsMySQLDatabase
0 ignored issues
show
Deprecated Code introduced by
The class XoopsMySQLDatabase has been deprecated: since version 2.6.0 - alpha 3. Switch to doctrine connector. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

33
class XoopsMySQLDatabaseProxy extends /** @scrutinizer ignore-deprecated */ XoopsMySQLDatabase
Loading history...
34
{
35
    /**
36
     * perform a query on the database
37
     *
38
     * this method allows only SELECT queries for safety.
39
     *
40
     * @param string $sql   a valid MySQL query
41
     * @param int    $limit number of records to return
42
     * @param int    $start offset of first record to return
43
     *
44
     * @return resource query result or FALSE if unsuccessful
45
     * @deprecated since version 2.6.0 - alpha 3. Switch to doctrine connector.
46
     */
47
    public function query($sql, $limit = 0, $start = 0)
48
    {
49
        $this->deprecated();
50
        $sql = ltrim($sql);
51
        if (!$this->allowWebChanges && strtolower(substr($sql, 0, 6)) !== 'select') {
52
            //trigger_error('Database updates are not allowed during processing of a GET request', E_USER_WARNING);
53
            return false;
54
        }
55
        return $this->queryF($sql, $limit, $start);
0 ignored issues
show
Deprecated Code introduced by
The function XoopsMySQLDatabase::queryF() has been deprecated: since version 2.6.0 - alpha 3. Switch to doctrine connector. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

55
        return /** @scrutinizer ignore-deprecated */ $this->queryF($sql, $limit, $start);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
56
    }
57
}
58