*/ declare(strict_types = 1); /** * Manages vocabulary groups. */ final class NodaGroup { private MDMysqli $_mysqli_noda; /** * Lists all active groups. * * @param integer $limit Limit. * @param integer $offset Offset. * * @return array */ public function list(int $limit = 50, int $offset = 0):array { $output = []; $result = $this->_mysqli_noda->query_by_stmt("SELECT `group_id`, `group_name` FROM `group` ORDER BY `group_id` DESC LIMIT ? OFFSET ?", "ii", $limit, $offset); while ($cur = $result->fetch_row()) { $output[] = [ 'id' => (int)$cur[0], 'name' => $cur[1], ]; } $result->close(); return $output; } /** * Constructor. * * @param MDMysqli $mysqli_noda DB connection. * * @return void */ public function __construct(MDMysqli $mysqli_noda) { $this->_mysqli_noda = $mysqli_noda; } }