src/Services/PDOs/Builders/Builder.php
protected function compileColumns($columns, $clause)
    {
        $list = [];
        foreach ((array)$columns as $alias => $column) {
            if (is_string($column) && preg_match('/^(?:([0-9a-zA-Z$_]+)\.)?([0-9a-zA-Z$_]+)$/s', trim($column), $match)) { // for maximum performance, first check the most common case..
                // yes, the expression is just a column name: "col1" or "t1.col1"!
                $column = (!empty($match[1]) ? $this->db->quoteName($match[1]) . '.' : '') . $this->db->quoteName($match[2]);
            }
            else {
                if (is_callable($column)) {
                    $column = $column(new static($this->db));
                }

                if ($column instanceof BuilderContract) {
                    $this->putBindings($clause, $column->bindings());
                    $column = $column->toSql();
                }

                $column = $this->compileExpression($column);
            }

            if (is_string($alias)) {
                if (strncasecmp($column, 'SELECT ', 7) === 0) {
                    $column = "($column)";
                }
                $column .= ' AS ' . $this->db->quoteName($alias);
            }

            $list[] = $column;
        }

        return $list;
    }
protected function compileColumns($columns, $clause)
    {
        $list = [];
        foreach ((array)$columns as $alias => $column) {
            if (is_string($column) && preg_match('/^(?:([0-9a-zA-Z$_]+)\.)?([0-9a-zA-Z$_]+)$/s', trim($column), $match)) { // for maximum performance, first check the most common case..
                // yes, the expression is just a column name: "col1" or "t1.col1"!
                $column = (!empty($match[1]) ? $this->db->quoteName($match[1]) . '.' : '') . $this->db->quoteName($match[2]);
            }
            else {
                if (is_callable($column)) {
                    $column = $column(new static($this->db));
                }

                if ($column instanceof BuilderContract) {
                    $this->putBindings($clause, $column->bindings());
                    $column = $column->toSql();
                }

                $column = $this->compileExpression($column);
            }

            if (is_string($alias)) {
                if (strncasecmp($column, 'SELECT ', 7) === 0) {
                    $column = "($column)";
                }
                $column .= ' AS ' . $this->db->quoteName($alias);
            }

            $list[] = $column;
        }

        return $list;
    }
protected function compileColumns ( $ columns , $ clause ) { $ list = [ ] ; foreach ( ( array ) $ columns as $ alias => $ column ) { if ( is_string ( $ column ) && preg_match ( '/^(?:([0-9a-zA-Z$_]+)\.)?([0-9a-zA-Z$_]+)$/s' , trim ( $ column ) , $ match ) ) { // for maximum performance, first check the most common case.. // yes, the expression is just a column name: "col1" or "t1.col1"! $ column = ( ! empty ( $ match [ 1 ] ) ? $ this -> db -> quoteName ( $ match [ 1 ] ) . '.' : '' ) . $ this -> db -> quoteName ( $ match [ 2 ] ) ; } else { if ( is_callable ( $ column ) ) { $ column = $ column ( new static ( $ this -> db ) ) ; } if ( $ column instanceof BuilderContract ) { $ this -> putBindings ( $ clause , $ column -> bindings ( ) ) ; $ column = $ column -> toSql ( ) ; } $ column = $ this -> compileExpression ( $ column ) ; } if ( is_string ( $ alias ) ) { if ( strncasecmp ( $ column , 'SELECT ' , 7 ) === 0 ) { $ column = "($column)" ; } $ column .= ' AS ' . $ this -> db -> quoteName ( $ alias ) ; } $ list [ ] = $ column ; } return $ list ; }
Render the column list.

@param string|array $columns One or more columns or subquery.
@param string $clause Key for the binding list: "select", "group" or "order"
@return array
Render the column list .