$column) { if (!is_object($column)) { $newColumn = array($column); $column = self::createColumn($newColumn, $table); if (!is_numeric($index)) { $column->setAlias($index); } $createdColumns[] = $column; } else if ($column instanceof Column) { $createdColumns[] = $column; } } return \array_filter($createdColumns); } /** * Creates a Column object. * * @param array $argument * @param null|Table $table * * @return Column */ public static function createColumn(array &$argument, $table = null) { $columnName = \array_values($argument); $columnName = $columnName[0]; $columnAlias = \array_keys($argument); $columnAlias = $columnAlias[0]; if (\is_numeric($columnAlias) || \strpos($columnName, '*') !== false) { $columnAlias = null; } return new Column($columnName, (string) $table, $columnAlias); } /** * Creates a Table object. * * @param string[] $table * * @return Table */ public static function createTable($table) { $tableName = $table; if (\is_array($table)) { $tableName = \current($table); $tableAlias = \key($table); } $newTable = new Table($tableName); if (isset($tableAlias) && !is_numeric($tableAlias)) { $newTable->setAlias($tableAlias); } return $newTable; } }