public function addSelect($columns, string $alias = null): self
    {
        if (!is_array($columns)) {
            if ($alias === null) {
                $columns = [$columns];
            } else {
                $columns = [$alias => $columns];
            }
        }

        foreach ($columns as $alias => $column) {
            $column = $this->checkStringValue('Argument $columns['.$alias.']', $column);

            if (is_string($alias)) {
                $this->select[$alias] = $column;
            } else {
                $this->select[] = $column;
            }
        }

        return $this;
    }
public function addSelect($columns, string $alias = null): self
    {
        if (!is_array($columns)) {
            if ($alias === null) {
                $columns = [$columns];
            } else {
                $columns = [$alias => $columns];
            }
        }

        foreach ($columns as $alias => $column) {
            $column = $this->checkStringValue('Argument $columns['.$alias.']', $column);

            if (is_string($alias)) {
                $this->select[$alias] = $column;
            } else {
                $this->select[] = $column;
            }
        }

        return $this;
    }
public function addSelect ( $ columns , string $ alias = null ) : self { if ( ! is_array ( $ columns ) ) { if ( $ alias === null ) { $ columns = [ $ columns ] ; } else { $ columns = [ $ alias => $ columns ] ; } } foreach ( $ columns as $ alias => $ column ) { $ column = $ this -> checkStringValue ( 'Argument $columns[' . $ alias . ']' , $ column ) ; if ( is_string ( $ alias ) ) { $ this -> select [ $ alias ] = $ column ; } else { $ this -> select [ ] = $ column ; } } return $ this ; }
Adds column or columns to the SELECT section.

@param string|\Closure|Query|StatementInterface|string[]|\Closure[]|Query[]|StatementInterface[] $columns Columns
to add. If string or raw, one column is added. If array, many columns are added and string indexes are
treated as aliases.
@param string|null $alias Column alias name. Used only if the first argument is not an array.
@return $this
@throws InvalidArgumentException
@throws InvalidReturnValueException
Adds column or columns to the SELECT section .