Granada\ORM::_join_if_not_empty PHP Method

_join_if_not_empty() protected method

Wrapper around PHP's join function which only adds the pieces if they are not empty.
protected _join_if_not_empty ( string $glue, $pieces ) : string
$glue string
return string
    protected function _join_if_not_empty($glue, $pieces)
    {
        $filtered_pieces = array();
        foreach ($pieces as $piece) {
            if (is_string($piece)) {
                $piece = trim($piece);
            }
            if (!empty($piece)) {
                $filtered_pieces[] = $piece;
            }
        }
        return join($glue, $filtered_pieces);
    }
ORM