private function createFunction($func, array $arguments = array(), $alias = null)
    {
        // Prepare function arguments
        foreach ($arguments as $index => $argument) {
            if ($argument instanceof RawSqlFragmentInterface) {
                $item = $argument->getFragment();
            } else {
                $item = $this->quote($argument);
            }

            // Update item collection
            $arguments[$index] = $item;
        }

        $fragment = sprintf(' %s(%s) ', $func, implode(', ', $arguments));

        // Generate alias if provided
        if (!is_null($alias)) {
            $fragment .= sprintf(' AS %s ', $this->quote($alias));
        }

        // Append a comma if there was a function call before
        if ($this->hasFunctionCall === true) {
            $this->append(', ');
        }

        $this->hasFunctionCall = true;
        return $fragment;
    }
private function createFunction($func, array $arguments = array(), $alias = null)
    {
        // Prepare function arguments
        foreach ($arguments as $index => $argument) {
            if ($argument instanceof RawSqlFragmentInterface) {
                $item = $argument->getFragment();
            } else {
                $item = $this->quote($argument);
            }

            // Update item collection
            $arguments[$index] = $item;
        }

        $fragment = sprintf(' %s(%s) ', $func, implode(', ', $arguments));

        // Generate alias if provided
        if (!is_null($alias)) {
            $fragment .= sprintf(' AS %s ', $this->quote($alias));
        }

        // Append a comma if there was a function call before
        if ($this->hasFunctionCall === true) {
            $this->append(', ');
        }

        $this->hasFunctionCall = true;
        return $fragment;
    }
private function createFunction ( $ func , array $ arguments = array ( ) , $ alias = null ) { // Prepare function arguments foreach ( $ arguments as $ index => $ argument ) { if ( $ argument instanceof RawSqlFragmentInterface ) { $ item = $ argument -> getFragment ( ) ; } else { $ item = $ this -> quote ( $ argument ) ; } // Update item collection $ arguments [ $ index ] = $ item ; } $ fragment = sprintf ( ' %s(%s) ' , $ func , implode ( ', ' , $ arguments ) ) ; // Generate alias if provided if ( ! is_null ( $ alias ) ) { $ fragment .= sprintf ( ' AS %s ' , $ this -> quote ( $ alias ) ) ; } // Append a comma if there was a function call before if ( $ this -> hasFunctionCall === true ) { $ this -> append ( ', ' ) ; } $ this -> hasFunctionCall = true ; return $ fragment ; }
Generates SQL function fragment

@param string $func Function name
@param array $arguments Optional function arguments
@param string $alias Optional alias
@return string
Generates SQL function fragment