src/Titon/Db/Driver/Dialect/AbstractDialect.php
public function formatFunction(Func $func) {
        $arguments = [];

        foreach ($func->getArguments() as $arg) {
            $type = $arg['type'];
            $value = $arg['value'];

            if ($value instanceof Func) {
                $value = $this->formatFunction($value);

            } else if ($value instanceof SubQuery) {
                $value = $this->formatSubQuery($value);

            } else if ($type === Func::FIELD) {
                $value = $this->quote($value);

            } else if ($type === Func::LITERAL) {
                // Do nothing

            } else if (is_string($value) || $value === null) {
                $value = $this->getDriver()->escape($value);
            }

            $arguments[] = $value;
        }

        $output = sprintf($this->getClause(self::FUNC),
            $func->getName(),
            implode($func->getSeparator(), $arguments)
        );

        if ($alias = $func->getAlias()) {
            $output = sprintf($this->getClause(self::AS_ALIAS), $output, $this->quote($alias));
        }

        return $output;
    }
public function formatFunction(Func $func) {
        $arguments = [];

        foreach ($func->getArguments() as $arg) {
            $type = $arg['type'];
            $value = $arg['value'];

            if ($value instanceof Func) {
                $value = $this->formatFunction($value);

            } else if ($value instanceof SubQuery) {
                $value = $this->formatSubQuery($value);

            } else if ($type === Func::FIELD) {
                $value = $this->quote($value);

            } else if ($type === Func::LITERAL) {
                // Do nothing

            } else if (is_string($value) || $value === null) {
                $value = $this->getDriver()->escape($value);
            }

            $arguments[] = $value;
        }

        $output = sprintf($this->getClause(self::FUNC),
            $func->getName(),
            implode($func->getSeparator(), $arguments)
        );

        if ($alias = $func->getAlias()) {
            $output = sprintf($this->getClause(self::AS_ALIAS), $output, $this->quote($alias));
        }

        return $output;
    }
public function formatFunction ( Func $ func ) { $ arguments = [ ] ; foreach ( $ func -> getArguments ( ) as $ arg ) { $ type = $ arg [ 'type' ] ; $ value = $ arg [ 'value' ] ; if ( $ value instanceof Func ) { $ value = $ this -> formatFunction ( $ value ) ; } else if ( $ value instanceof SubQuery ) { $ value = $ this -> formatSubQuery ( $ value ) ; } else if ( $ type === Func :: FIELD ) { $ value = $ this -> quote ( $ value ) ; } else if ( $ type === Func :: LITERAL ) { // Do nothing } else if ( is_string ( $ value ) || $ value === null ) { $ value = $ this -> getDriver ( ) -> escape ( $ value ) ; } $ arguments [ ] = $ value ; } $ output = sprintf ( $ this -> getClause ( self :: FUNC ) , $ func -> getName ( ) , implode ( $ func -> getSeparator ( ) , $ arguments ) ) ; if ( $ alias = $ func -> getAlias ( ) ) { $ output = sprintf ( $ this -> getClause ( self :: AS_ALIAS ) , $ output , $ this -> quote ( $ alias ) ) ; } return $ output ; }
Format a database function.

@param \Titon\Db\Query\Func $func
@return string
Format a database function .