1 | <?php |
||
10 | abstract class Model |
||
11 | { |
||
12 | /** |
||
13 | * @var Database |
||
14 | */ |
||
15 | public static $db; |
||
16 | |||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $primaryKey = "id"; |
||
21 | |||
22 | /** |
||
23 | * @var null |
||
24 | */ |
||
25 | protected static $table = null; |
||
26 | |||
27 | /** |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $data = array(); |
||
31 | |||
32 | /** |
||
33 | * @var bool |
||
34 | */ |
||
35 | protected $isNewRow = true; |
||
36 | |||
37 | /** |
||
38 | * @param array $data |
||
39 | * @param bool $isNewRow |
||
40 | */ |
||
41 | public function __construct($data = array(), $isNewRow = true) |
||
46 | |||
47 | /** |
||
48 | * @param array $data |
||
49 | * @return static |
||
50 | */ |
||
51 | public static function create($data = array()) |
||
55 | |||
56 | /** |
||
57 | * @param null $columns |
||
58 | * @return Database |
||
59 | */ |
||
60 | public static function select($columns = null) |
||
65 | |||
66 | /** |
||
67 | * @param $name |
||
68 | * @return array |
||
69 | */ |
||
70 | public function __get($name) |
||
74 | |||
75 | /** |
||
76 | * @param $name |
||
77 | * @param $value |
||
78 | */ |
||
79 | public function __set($name, $value) |
||
83 | |||
84 | /** |
||
85 | * |
||
86 | */ |
||
87 | public function delete() |
||
91 | |||
92 | /** |
||
93 | * INSERT AND UPDATE Model |
||
94 | */ |
||
95 | public function save() |
||
117 | } |
||
118 |
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.
Unreachable code is most often the result of
return
,die
orexit
statements that have been added for debug purposes.In the above example, the last
return false
will never be executed, because a return statement has already been met in every possible execution path.