Converts the simple data table to an array

@param Simple $table
@return array
326458
protected function renderSimpleTable($table)
    {
        $array = array();

        $row = $table->getFirstRow();
        if ($row === false) {
            return $array;
        }
        foreach ($row->getColumns() as $columnName => $columnValue) {
            $array[$columnName] = $columnValue;
        }
        return $array;
    }
1044039
protected function buildHeaders(Table $table)
	{
		//Generate each row
		$rows = array();

		foreach ( $table->getHeaderRows() as $row )
		{
			//Build the cells for each row
			$cells = array();

			foreach ( $row as $cell )
			{
				$cells[] = $this->headerCell($cell);
			}

			$rows[] = $this->headerRow($row, $cells);
		}

		return $rows;
	}
35050
public function getTableColumns($table)
    {
        $driver = $this->getDriverName();
        $bind = [];
        if ($driver == 'sqlite') {
            $table = $this->quoteIdentifiers($table);
            $sql = 'PRAGMA table_info(' . $table . ');';
            $key = 'name';
        } elseif ($driver == 'mysql') {
            $table = $this->quoteIdentifiers($table);
            $sql = 'DESCRIBE ' . $table . ';';
            $key = 'Field';
        } else {
            $bind[] = $table;
            $sql = 'SELECT column_name FROM information_schema.columns WHERE ';
            if($driver == 'pgsql'){
                $bind = explode('.', $table, 2);
                if(count($bind) == 2){
                    $sql.='table_schema = ? AND ';
                }
            }
            $sql.='table_name = ? ;';
            $key = 'column_name';
        }

        $fields = [];
        if (is_array($list = $this->run($sql, $bind, false))) {
            foreach ($list as $record) {
                $fields[] = $record[$key];
            }
            return $fields;
        }
        return $fields;
    }
788076
protected function getPrimaryKeys(array $table): array
    {
        $primaryKeys = [];
        foreach ($table['columns'] as $column) {
            $columnName = $column['COLUMN_NAME'];
            $columnKey = $column['COLUMN_KEY'];
            if ($columnKey !== 'PRI') {
                continue;
            }
            $primaryKeys[] = $columnName;
        }

        return $primaryKeys;
    }
499095
private function getFields($table)
    {
        $fields = $this->entity->getFieldNames();
        if (empty($this->with) && $this->alias === null) {
            return $fields;
        }

        $table = $this->getTableAlias($table);

        $prefixIfMissing = function ($field) use ($table) {
            if (strpos($field, '.') !== false) {
                return $field;
            }

            return $table . '.' . $field;
        };

        return array_map($prefixIfMissing, $fields);
    }
752270
protected function _fetchTableIndexes($table)
    {
        $result = array();
        $sql    = $this->quoteName($this->getTableNeedle().$table);

        if ($indexes = $this->show('SHOW INDEX FROM '.$sql, AnDatabase::FETCH_OBJECT_LIST)) {
            foreach ($indexes as $index) {
                $result[$index->Key_name][$index->Seq_in_index] = $index;
            }
        }

        return $result;
    }
124391
protected function _getFields(Table $table)
    {
        $fields = explode(',', $this->args[1]);
        foreach ($fields as $field) {
            if (!$table->hasField($field)) {
                $this->abort(sprintf('Table `%s` is missing the field `%s`.', $table->table(), $field));
            }
        }

        return $fields;
    }
702329
protected function getColsList(string $table): array
    {
        $schema = $this->conn->getSchemaManager();
        $tableDetails = $schema->listTableDetails($table);
        // No primary ? Exception !
        if ($tableDetails->hasPrimaryKey() === false) {
            throw new NeuralyzerConfigurationException("Can't work with $table, it has no primary key.");
        }
        $primaryKey = $tableDetails->getPrimaryKey()->getColumns()[0];

        $cols = $schema->listTableColumns($table);
        $colsInfo = [];
        foreach ($cols as $col) {
            // If the col has to be ignored: just leave
            if ($primaryKey === $col->getName() || $this->colIgnored($table, $col->getName())) {
                continue;
            }

            $colsInfo[] = [
                'name' => $col->getName(),
                'type' => strtolower((string) $col->getType()),
                'len' => $col->getLength(),
            ];
        }

        return $colsInfo;
    }
237288
public function get_indexes($table) {
        $indexes = array();
        $sql = "SHOW INDEXES FROM {$this->prefix}$table";
        $this->query_start($sql, null, SQL_QUERY_AUX);
        $result = $this->mysqli->query($sql);
        try {
            $this->query_end($result);
        } catch (dml_read_exception $e) {
            return $indexes; // table does not exist - no indexes...
        }
        if ($result) {
            while ($res = $result->fetch_object()) {
                if ($res->Key_name === 'PRIMARY') {
                    continue;
                }
                if (!isset($indexes[$res->Key_name])) {
                    $indexes[$res->Key_name] = array('unique'=>empty($res->Non_unique), 'columns'=>array());
                }
                $indexes[$res->Key_name]['columns'][$res->Seq_in_index-1] = $res->Column_name;
            }
            $result->close();
        }
        return $indexes;
    }
175245
final public function from($table)
    {

        $table = (is_array($table)) ? (array)$table : (strpos($table, ',') !== FALSE) ? explode(',', $table) : array($table);

        foreach ($table as $source) {

            if (empty($source))
                continue;

            //First check for the presence of any aliasis
            $source = trim($source);
            $this->traceTableAlias($source);

            $this->arrayFrom[] = $this->identifiers($source);

            if ($this->arrayCaching) {
                $this->arrayCacheFrom[] = $this->identifiers($source);
                $this->arrayCacheExists[] = 'from';
            }
        }
        return $this;
    }
25890
public function getMultilangFields($table)
    {
        $fields = $this->getFields($table);
        $multiLangFields = [];

        foreach ($fields as $field) {
            if (preg_match("/({$table}\.)?(?<field>.+)_1$/", $field, $matches)) {
                $multiLangFields[] = $matches['field'];
            }
        }

        return $multiLangFields;
    }
608272
public function getFields ($table)
		{
			$sql = "SHOW COLUMNS FROM " . $this->quoteIdentifier($table);

			return $this->query($sql)->fetchColumn('Field');
		}
57538
public function getCreateTable($table)
    {
        $tableName = $this->validTableName($table['table']);
        $sql = '';
        foreach ($table['fields'] as $field => $value) {
            $sql .= ($sql === '') ? '' : ', ';
            $sql .= '`' . $field . '` ' . $value['type'];
            if (isset($value['autoincrement']) && $value['autoincrement']) {
                $sql .= ' AUTO_INCREMENT PRIMARY KEY';
            }
            if (isset($value['primary']) && $value['primary']) {
                $sql .= ' PRIMARY KEY';
            }
        }

        return 'CREATE TABLE ' . $tableName . '(' . $sql . ')';
    }
42493
protected function getAlternatePrimaryKeys($table)
    {
        $alternatePrimaryKey = false;
        $primaryKeys = [];
        foreach ($table['columns'] as $column) {
            $columnName = $column['COLUMN_NAME'];
            $columnKey = $column['COLUMN_KEY'];
            if ($columnKey !== 'PRI') {
                continue;
            }
            if ($columnName !== 'id') {
                $alternatePrimaryKey = true;
            }
            $primaryKeys[] = '"' . $columnName . '"';
        }
        if ($alternatePrimaryKey) {
            return $primaryKeys;
        }

        return null;
    }
1314774
public function getHash($table)
    {
        $fields = array();
        if (isset($table['fields'])) {
            $fields = $table['fields'];
        }
        if (isset($table['field'])) {
            $fields = array($table);
        }
        if (isset($table['keys'])) {
            $fields += $table['keys'];
        }
        $list = array_map(array($this, 'encode_hash'), $fields);
        ksort($list);
        return sha1(strtolower(implode('-', array_keys($list)) . implode('-', $list)));
    }
519378
public static function dumpTable($table)
    {
        $tokens = array();
        foreach ($table as $name => $value) {
            switch ($value[0]) {
                case 'D':
                    $val = $value[1]->n . 'E' . $value[1]->e;
                    break;
                case 'F':
                    $val = '(' . self::dumpTable($value[1]) . ')';
                    break;
                case 'T':
                    $val = date('Y-m-d H:i:s', $value[1]);
                    break;
                default:
                    $val = $value[1];
            }
            $tokens[] = $name . '=' . $val;
        }
        return implode(', ', $tokens);
    }
1193121
protected function generateColumns($table): array
    {
        $columns = $table->getColumns();
        $result  = [
            'columns'          => [],
            'hasSoftDelete'    => false,
            'hasRememberToken' => false,
        ];
        foreach ($columns as $column) {
            if ($column->getName() === 'id') {
                continue;
            }
            if (($column->getName() === 'created_at' || $column->getName() === 'updated_at') and ($column->getType() === 'timestamp' || $column->getType() === 'timestamp_f')) {
                continue;
            }
            if ($column->getName() === 'deleted_at' and ($column->getType() === 'timestamp' || $column->getType() === 'timestamp_f')) {
                $result['hasSoftDelete'] = true;
                continue;
            }
            if ($column->getName() === 'remember_token' and $column->getType() === 'varchar') {
                $result['hasRememberToken'] = true;
                continue;
            }

            $columnObject = new Column($column);
            $line         = $columnObject->generateAddMigration();

            $result['columns'][] = $line.';';
        }

        return $result;
    }