lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
public function getTrimExpression($str, $mode = TrimMode::UNSPECIFIED, $char = false)
    {
        $expression = '';

        switch ($mode) {
            case TrimMode::LEADING:
                $expression = 'LEADING ';
                break;

            case TrimMode::TRAILING:
                $expression = 'TRAILING ';
                break;

            case TrimMode::BOTH:
                $expression = 'BOTH ';
                break;
        }

        if ($char !== false) {
            $expression .= $char . ' ';
        }

        if ($mode || $char !== false) {
            $expression .= 'FROM ';
        }

        return 'TRIM(' . $expression . $str . ')';
    }
public function getTrimExpression($str, $mode = TrimMode::UNSPECIFIED, $char = false)
    {
        $expression = '';

        switch ($mode) {
            case TrimMode::LEADING:
                $expression = 'LEADING ';
                break;

            case TrimMode::TRAILING:
                $expression = 'TRAILING ';
                break;

            case TrimMode::BOTH:
                $expression = 'BOTH ';
                break;
        }

        if ($char !== false) {
            $expression .= $char . ' ';
        }

        if ($mode || $char !== false) {
            $expression .= 'FROM ';
        }

        return 'TRIM(' . $expression . $str . ')';
    }
public function getTrimExpression ( $ str , $ mode = TrimMode :: UNSPECIFIED , $ char = false ) { $ expression = '' ; switch ( $ mode ) { case TrimMode :: LEADING : $ expression = 'LEADING ' ; break ; case TrimMode :: TRAILING : $ expression = 'TRAILING ' ; break ; case TrimMode :: BOTH : $ expression = 'BOTH ' ; break ; } if ( $ char !== false ) { $ expression .= $ char . ' ' ; } if ( $ mode || $ char !== false ) { $ expression .= 'FROM ' ; } return 'TRIM(' . $ expression . $ str . ')' ; }
Returns the SQL snippet to trim a string.

@param string      $str  The expression to apply the trim to.
@param int         $mode The position of the trim (leading/trailing/both).
@param string|bool $char The char to trim, has to be quoted already. Defaults to space.

@return string
Returns the SQL snippet to trim a string .