Convert table to array. First row contains column names
@return array Collection of rows of columns values
766243
public function & toArray()
    {
        // Create column headers
        $cols = array();

        // Fill material categories columns
        for ($i = 0; $i < $this->structureCount; $i++) {
            $cols[] = 'Категория №'.$i;
        }

        // Add standard
        $cols = array_merge($cols, array('ID', 'Name', 'URL'));

        foreach ($this->fields as $field) {
            $cols[] = trim($field->Name);
        }

        $result = array($cols);

        // Iterate db data and perform rendering
        foreach ($this->query->exec() as & $db_row) {
            // Fill all row columns
            $cols = array();

            // Fill material categories columns
            $count = 0;
            foreach ($this->materialStructures[$db_row->id] as $structures) {
                $cols[] = $structures;
                $count++;
            }
            // Fill empty categories
            for ($i = $count; $i < $this->structureCount; $i++) {
                $cols[] = '';
            }

            // Add standard material data
            $cols[] = $db_row->id;
            $cols[] = $db_row->Name;
            $cols[] = $db_row->Url;

            foreach ($this->fields as $field) {
                $cols[] = trim($db_row[$field->Name]);
            }
            $result[] = $cols;
        }

        return $result;
    }
407045
public function toArray()
    {
        $array = parent::toArray();

        // Typecast every known field with it's respective data-type.
        // Integer, float and boolean fields may vary accourding to the
        // database engine
        if (isset($this->schema['attributes'])) {
            foreach($this->schema['attributes'] as $attribute) {
                @settype($array[$attribute['name']], $attribute['type']);
            }
        }

        $observer = static::getObserver($this->getTable());
        if ($observer) {
            if (method_exists($observer, 'toArray')) {
                return $observer->toArray($this, $array);
            }
        }

        return $array;
    }
996116
public function columns() : array
    {
        if ($this->numRows() > 1) {
            return array_map(null, ...$this->samples);
        }

        $n = $this->numColumns();

        $columns = [];

        for ($i = 0; $i < $n; $i++) {
            $columns[] = array_column($this->samples, $i);
        }

        return $columns;
    }
79477
public function toArray()
    {
        $res = [];
        foreach ([
            'id',
            'displayTitle',
            'street',
            'number',
            'code',
            'town',
            'country',
            'longitude',
            'latitude',
        ] as $propertyName) {
            $res[$propertyName] = $this->{'get' . ucfirst($propertyName)}();
        }

        $res['name'] = TextUtils::truncate($this->getDisplayTitle(), 75);

        return $res;
    }
1096813
public function asArray()
    {
        $data = [];
        $columns = Manager::getInstance()->get($this)->getColumns();
        foreach(array_keys($columns) as $field) {
            $data[trim($field, '_')] = $this->$field;
        }
        $relations = Manager::getInstance()->get($this)->getRelations();
        foreach(array_keys($relations) as $field) {
            if ($this->$field instanceof Entity) {
                $data[trim($field, '_')] = $this->$field->asArray();
            } elseif ($this->$field instanceof RecordList) {
                $values = [];
                /** @var Entity $entity */
                foreach ($this->$field as $entity) {
                    $values[] = $entity->asArray();
                }
                $data[trim($field, '_')] = $values;
            } else {
                $data[trim($field, '_')] = $this->$field;
            }
        }
        return $data;

    }
798449
public function getColumns()
    {
        if (!$this->columns && $this->length()) {
            if ($this->first() instanceof DataInterface) {
                $this->columns = array_keys($this->first()->toArray());
            } elseif (is_array($this->first())) {
                $this->columns = array_keys($this->first());
            }
        }

        return $this->columns;
    }
1350008
public function toArray() {
        $r = [
            'from' => $this->from,
            'where' => $this->where,
            'order' => $this->order,
            'limit' => $this->limit,
            'offset' => $this->offset
        ];

        return $r;
    }
821998
protected function getColumnWidths()
    {
        $first_row = reset($this->data);

        // Create an array with the columns as keys and values of zero
        $column_widths = $this->getDefaultColumnWidths($first_row);

        foreach ($this->data as $columns) {
            foreach ($columns as $key => $column) {
                $column_widths[$key] = $this->getCellWidth($column_widths[$key], $column);
            }
        }

        return $column_widths;
    }
633676
protected function getTableColumns()
    {
        if (0 === count(self::$tableColumns)) {
            $table = $this->getTable();
            $connect = $this->getConnection();
            $builder = $connect->getSchemaBuilder();
            $columns = $builder->getColumnListing($table);

            self::$tableColumns = (array)$columns;
        }
        return self::$tableColumns;
    }
970231
public function __toArray()
    {
        $datas = [
            'id'   => (string)$this->id,
            'type' => (string)$this->type
        ];
        if ($this->attributes !== null) {
            $datas['attributes'] = $this->attributes->__toArray();
        }
        return $datas;
    }
13145
public function toArray()
    {
        $ret = [ ];
        foreach ($this as $key => $value) {
            $ret[ $key ] = $value;
        }
        return $ret;
    }
968250
public function toArray()
	{
		$output = array();

		foreach ($this->items as $key => $value) {
			array_push($output, $value->toArray(true));
		}

		return array(
			$this->getEntityName() => array(
					$this->getSingularEntityName() => $output
				),
		);
	}
313843
public function toArray(): array
    {
        return [
            'name' => $this->name,
            'text' => $this->text,
            'type' => $this->type,
            'value' => $this->value,
            'style' => $this->style,
            'confirm' => $this->confirmation,
        ];
    }
480457
public function columns(): array
    {
        return [
            new CensusColumnFullName($this, 'Name', 'Name'),
            new CensusColumnRelationToHead($this, 'Relation', 'Relationship of each person to the head of the family'),
            new CensusColumnNull($this, 'Home', 'Home owned or rented'),
            new CensusColumnNull($this, 'V/R', 'Value of house, if owned, or monthly rental if rented'),
            new CensusColumnNull($this, 'Radio', 'Radio set'),
            new CensusColumnNull($this, 'Farm', 'Does this family live on a farm'),
            new CensusColumnSexMF($this, 'Sex', 'Sex'),
            new CensusColumnNull($this, 'Race', 'Color or race'),
            new CensusColumnAge($this, 'Age', 'Age at last birthday'),
            new CensusColumnConditionUs($this, 'Cond', 'Whether single, married, widowed, or divorced'),
            new CensusColumnAgeMarried($this, 'AM', 'Age at first marriage'),
            new CensusColumnNull($this, 'School', 'Attended school since Sept. 1, 1929'),
            new CensusColumnNull($this, 'R/W', 'Whether able to read and write'),
            new CensusColumnBirthPlaceSimple($this, 'BP', 'Place of birth'),
            new CensusColumnFatherBirthPlaceSimple($this, 'FBP', 'Place of birth of father'),
            new CensusColumnMotherBirthPlaceSimple($this, 'MBP', 'Place of birth of mother'),
            new CensusColumnNull($this, 'Lang', 'Language spoken in home before coming to the United States'),
            new CensusColumnNull($this, 'Imm', 'Year of immigration to the United States'),
            new CensusColumnNull($this, 'Nat', 'Naturalization'),
            new CensusColumnNull($this, 'Eng', 'Whether able to speak English'),
            new CensusColumnOccupation($this, 'Occupation', 'Trade, profession, or particular kind of work done'),
            new CensusColumnNull($this, 'Industry', 'Industry, business of establishment in which at work'),
            new CensusColumnNull($this, 'Code', 'Industry code'),
            new CensusColumnNull($this, 'Emp', 'Class of worker'),
            new CensusColumnNull($this, 'Work', 'Whether normally at work yesterday or the last regular working day'),
            new CensusColumnNull($this, 'Unemp', 'If not, …'),
            new CensusColumnNull($this, 'Vet', 'Whether a veteran of U.S. military or …'),
            new CensusColumnNull($this, 'War', 'What war or …'),
        ];
    }
1152942
protected function columns()
    {
        $this->data    = $this->setData();
        $column_widths = $this->getColumnWidths();
        $output        = [];
        $count         = count(reset($this->data));

        for ($i = 0; $i < $count; $i++) {
            $output[] = $this->getRow($i, $column_widths);
        }

        return $output;
    }
1139896
public function toArray()
    {
        $result = [];
        foreach ($this as $key => $value) {
            $result[$key] = $value;
        }
        return $result;
    }
281711
public function toArray()
    {
        $result = [];

        if (!empty($this->name)) {
            $result['name'] = $this->name;
        }

        if (!empty($this->alias)) {
            $result['alias'] = $this->alias;
        }

        if (!empty($this->using)) {
            $result['using'] = $this->using->toArray();
        }

        if (!empty($this->family)) {
            $result['family'] = $this->family->toArray();
        }

        if (!empty($this->version)) {
            $result['version'] = $this->version->toArray();
        }

        if (!empty($this->type)) {
            $result['type'] = $this->type;
        }

        if (isset($result['version']) && empty($result['version'])) {
            unset($result['version']);
        }

        return $result;
    }