Used to work out what kind of table is needed to display stats.

@return bool whether this question has (a subpart with) more than one response class.
767504
public function has_multiple_response_classes() {
        foreach ($this->get_variant_nos() as $variantno) {
            foreach ($this->get_subpart_ids($variantno) as $subpartid) {
                if ($this->get_analysis_for_subpart($variantno, $subpartid)->has_multiple_response_classes()) {
                    return true;
                }
            }
        }
        return false;
    }
1162052
protected function checkTableExists()
  {
    $m = $this->getManager();

    $q = 'SHOW TABLES LIKE "' . $m->getPrefix() . $this->getTable() . '"';

    return (bool)$m->query($q)->rowCount();
  }
32872
public boolean isComplexQuery()
    {
        for (int i = 0; i < this.getRecordlistCount(); i++)
        {
            if (this.getRecordlistAt(i).getTable() instanceof org.jbundle.base.db.shared.MultiTable)
                return true;
        }
        return false;
    }
516919
public function isMultiPart()
    {
        $contentType = $this->getContentType();
        if ($contentType !== null) {
            // casting to bool, preg_match returns 1 for true
            return (bool) (preg_match(
                '~multipart/\w+~i',
                $contentType->getValue()
            ));
        }
        return false;
    }
787213
public function is_used() {
        global $DB;
        global $CFG;

        // count grade items excluding the
        $params = array($this->id);
        $sql = "SELECT COUNT(id) FROM {grade_items} WHERE scaleid = ? AND outcomeid IS NULL";
        if ($DB->count_records_sql($sql, $params)) {
            return true;
        }

        // count outcomes
        $sql = "SELECT COUNT(id) FROM {grade_outcomes} WHERE scaleid = ?";
        if ($DB->count_records_sql($sql, $params)) {
            return true;
        }

        // Ask the competency subsystem.
        if (\core_competency\api::is_scale_used_anywhere($this->id)) {
            return true;
        }

        // Ask all plugins if the scale is used anywhere.
        $pluginsfunction = get_plugins_with_function('scale_used_anywhere');
        foreach ($pluginsfunction as $plugintype => $plugins) {
            foreach ($plugins as $pluginfunction) {
                if ($pluginfunction($this->id)) {
                    return true;
                }
            }
        }

        return false;
    }
1103382
private function hasSchema()
    {
        return $this->database
            && ($this->schema ?: $this->database->getSchema())
            && ($platform = $this->getPlatform())
            && $platform->supportsSchemas()
        ;
    }
586753
public function hasNext(): bool
    {
        return !empty($this->entries) && ($this->getStartIndex() + $this->getItemsPerPage() - 1 < $this->getTotalResults());
    }
726839
public function isFull()
    {
        return (bool) (pow($this->size, 2) == count(array_filter(array_reduce($this->getBoard(), 'array_merge', []))));
    }
688644
public function checkUsersTable() {
        if (!$this->usersTable) {
            $this->setUsersTable($this->in('What is the name of your users table?'));
        }

        $this->out(sprintf('Users Table: <info>%s</info>', $this->usersTable));

        $answer = strtoupper($this->in('Is this correct?', array('Y', 'N')));

        if ($answer === 'N') {
            $this->usersTable = null;
            $this->checkUsersTable();
        } else {
            $this->setRequiredTables(array($this->usersTable));
        }

        $this->checkUsersModel();

        $this->out('<success>Users table set, proceeding...</success>');
        return true;
    }
436108
protected function areRequirementsMet(): bool
    {
        return (bool) $this->useStatements = UseStatementHelper::getUseStatements(
            $this->getFile()->getBaseFile(),
            $this->getStackPos()
        );
    }
1357642
public function showSchemaInTable()
    {
        //change connection if provide
        if ($this->option('c')) {
            $this->schema->setConnection($this->option('c'));
            $this->schema->switchWrapper();
        }

        $tables = $this->schema->databaseWrapper->getTables();
        $headers = $this->schema->headers;

        if (!count($tables)) {
            $this->warn('Database does not contain any table');
        }

        $tableName = $this->option('t');
        if ($tableName) {
            if ($this->isNamespaceModel($tableName)) {
                $tableName = $this->tableNameFromModel($tableName);
            }
            if (!in_array($tableName, $tables)) {
                $this->warn('Table name is not correct!');
                return false;
            }

            $body = $this->schema->databaseWrapper->getColumns($tableName);
            $rowsCount = $this->schema->getTableRowCount($tableName);
            $this->info($tableName . ' (rows: ' . $rowsCount . ')');
            $this->table($headers, $body);
            return true;
        }

        foreach ($this->schema->databaseWrapper->getSchema() as $key => $value) {
            $this->info($key . ' (rows: ' . $value['rowsCount'] . ')');
            $this->table($headers, $value['attributes']);
            $this->line('');
        }
    }
1202302
public function isSupported()
    {
        $table = $this->getMixer();

        //Only check if we are connected with a table object, otherwise just return true.
        if($table instanceof DatabaseTableInterface)
        {
            if(!$table->hasColumn('modified_by') && !$table->hasColumn('modified_on')) {
                return false;
            }
        }

        return true;
    }
829345
public function hasNextPost()
    {
        return ($this->nextPost && $this->nextPost->ID !== $this->get('ID')) ? true : false;
    }
1258635
public function hasDataInPostsType()
    {
        $postTypes = PostType::all();
        foreach($postTypes as $postType){
            $hasData = DB::table($postType->slug)->where("createdByUserID", $this->userID)->count();
            if($hasData) {
                return true;
            }

            foreach($postType->fields as $field){
                if($field->type->inputType == "db" && $field->dbTable->name == "users") {
                    if($field->translatable) {
                        if($field->isMultiple) {
                            foreach(Language::all() as $language){
                                $hasData = DB::table("post_articles")->whereRaw("JSON_CONTAINS($field->slug->\"$.$language->slug\", '[$this->userID]')")->count();
                                if($hasData) { return true;
                                }
                            }
                        }else{
                            foreach(Language::all() as $language){
                                $hasData = DB::table($postType->slug)->where($field->slug."->".$language->slug, $this->userID)->count();
                                if($hasData) { return true;
                                }
                            }
                        }
                    }else{
                        if($field->isMultiple) {
                            $hasData = DB::table($postType->slug)->whereRaw("JSON_CONTAINS($field->slug, '[$this->userID]')")->count();
                            if($hasData) { return true;
                            }
                        }else{
                            $hasData = DB::table($postType->slug)->where($field->slug, $this->userID)->count();
                            if($hasData) { return true;
                            }
                        }
                    }
                }

            }

        }
        return false;
    }
542587
public function has_submissions_or_grades() {
        $allgrades = $this->count_grades();
        $allsubmissions = $this->count_submissions();
        if (($allgrades == 0) && ($allsubmissions == 0)) {
            return false;
        }
        return true;
    }
1019055
protected function hasTablesOrViews()
    {
        $tables = $this->db->query('SHOW TABLES', DbAdapter::QUERY_MODE_EXECUTE);

        return (bool) count($tables);
    }
1319270
protected function output_quiz_structure_analysis_table($questionstats) {
        $limitvariants = !$this->table->is_downloading();
        foreach ($questionstats->get_all_slots() as $slot) {
            // Output the data for these question statistics.
            $structureanalysis = $questionstats->structure_analysis_for_one_slot($slot, $limitvariants);
            if (is_null($structureanalysis)) {
                $this->table->add_separator();
            } else {
                foreach ($structureanalysis as $row) {
                    $bgcssclass = '';
                    // The only way to identify in this point of the report if a row is a summary row
                    // is checking if it's a instance of calculated_question_summary class.
                    if ($row instanceof \core_question\statistics\questions\calculated_question_summary) {
                        // Apply a custom css class to summary row to remove border and reduce paddings.
                        $bgcssclass = 'quiz_statistics-summaryrow';

                        // For question that contain a summary row, we add a "hidden" row in between so the report
                        // display both rows with same background color.
                        $this->table->add_data_keyed([], 'd-none hidden');
                    }

                    $this->table->add_data_keyed($this->table->format_row($row), $bgcssclass);
                }
            }
        }

        $this->table->finish_output(!$this->table->is_downloading());
    }