protected function addAggregate(string $function, $column, string $alias = null): self
    {
        $column = $this->checkStringValue('Argument $column', $column);

        $aggregate = new Aggregate($function, $column);
        if ($alias === null) {
            $this->select[] = $aggregate;
        } else {
            $this->select[$alias] = $aggregate;
        }

        return $this;
    }
protected function addAggregate(string $function, $column, string $alias = null): self
    {
        $column = $this->checkStringValue('Argument $column', $column);

        $aggregate = new Aggregate($function, $column);
        if ($alias === null) {
            $this->select[] = $aggregate;
        } else {
            $this->select[$alias] = $aggregate;
        }

        return $this;
    }
protected function addAggregate ( string $ function , $ column , string $ alias = null ) : self { $ column = $ this -> checkStringValue ( 'Argument $column' , $ column ) ; $ aggregate = new Aggregate ( $ function , $ column ) ; if ( $ alias === null ) { $ this -> select [ ] = $ aggregate ; } else { $ this -> select [ $ alias ] = $ aggregate ; } return $ this ; }
Adds an arbitrary aggregate to the SELECT section.

@param string $function Aggregate function name
@param string|\Closure|Query|StatementInterface $column Column to count (not prefixed)
@param string|null $alias Aggregate alias name
@return $this
@throws InvalidArgumentException
@throws InvalidReturnValueException
Adds an arbitrary aggregate to the SELECT section .