database = $in_database; $this->get_static = function($name) { return self::$$name; }; } public function get_all_devices($only_with_location) { $s = $this->get_static; $sql = "SELECT {$s("column_device_id")}, {$s("column_device_name")}, {$s("column_lat")}, {$s("column_long")} FROM {$s("table_name")}"; if($only_with_location) $sql .= "\nWHERE {$s("column_lat")} IS NOT NULL AND {$s("column_long")} IS NOT NULL"; $sql .= ";"; return $this->database->query($sql)->fetchAll(); } }