1 | <?php |
||
7 | class Model |
||
8 | { |
||
9 | private static $db; |
||
10 | public $db_fields = []; |
||
11 | public static $ID; |
||
12 | protected static $child_class; |
||
13 | |||
14 | public function __construct() |
||
15 | { |
||
16 | self::$db = new Database(); |
||
17 | self::$child_class = get_called_class(); |
||
18 | } |
||
19 | |||
20 | /** |
||
21 | * Will make it possible to assign key value pairs dynamically |
||
22 | * in the child class |
||
23 | */ |
||
24 | public function __set($key, $value) |
||
28 | |||
29 | /** |
||
30 | * Save a record in the table |
||
31 | * calls the insert method in the Database class |
||
32 | */ |
||
33 | public function save() |
||
39 | |||
40 | /** |
||
41 | * Update a record in the table |
||
42 | */ |
||
43 | public function update() |
||
51 | |||
52 | /** |
||
53 | * Remove a record from the table with the specified ID |
||
54 | * @param in $id ID of record you want to remove |
||
55 | */ |
||
56 | public static function remove($id) |
||
67 | |||
68 | /** |
||
69 | * @param int $id ID of the record to be retrieved |
||
70 | * @return object Instance of the Class |
||
71 | */ |
||
72 | public static function find($id) |
||
91 | |||
92 | public static function findWhere($conditions = array(), $fields = '*', $order = '', $limit = null, $offset = '') |
||
108 | |||
109 | // public static function findWherein($query) |
||
110 | // { |
||
111 | // $s = new static(); |
||
112 | // $results = self::$db->prepare($query); |
||
113 | // $results->setFetchMode(PDO::FETCH_ASSOC); |
||
114 | |||
115 | // return $results->fetch(); |
||
116 | // } |
||
117 | |||
118 | /** |
||
119 | * Finds all records in the table |
||
120 | * @return array |
||
121 | */ |
||
122 | public static function findAll() |
||
130 | } |
||
131 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.