Do you mean something like this?
```
if ($targetClass->isInheritanceTypeJoined()) {
    $ctiJoins = $this->_generateClassTableInheritanceJoins($targetClass, $joinedDqlAlias);
    if ( $withCondition ) {
        $sql .= '(' . $targetTableJoin['table'] . $ctiJoins . ') ON ' . $targetTableJoin['condition'];
    } else {
        $sql .= $targetTableJoin['table'] . ' ON ' . $targetTableJoin['condition'] . $ctiJoins;
    }
} else {
    $sql .= $targetTableJoin['table'] . ' ON ' . $targetTableJoin['condition'];
}

if ($withCondition ) {
    $sql .= ' AND ' . $withCondition;
}
```

And, yet one question. What do you think about string interpolation instead of concatenation?
`$sql .= "({$targetTableJoin['table']}{$ctiJoins}) ON {$targetTableJoin['condition']}";`
looks better and will work bit faster than
`$sql .= '(' . $targetTableJoin['table'] . $ctiJoins . ') ON ' . $targetTableJoin['condition'];`