I'm writing code to do line printing to a template -- counting characters to box A, then to box B, etc. -- and as such, it's not very modular. There are a lot of (long) variable names and each statement, which adds to the string to be printed, is pretty long.
So I've been breaking up the statements across multiple lines. But I don't know how I should be indenting it or where I should put the semicolon.
Here's a sample line:
$rbt .= "\n" . str_repeat(" ", $rbtSt_billToBox_leadingWidth) . padBothAndTruncate($statementInfoArray['bill-to-addr1'], $rbtSt_billToBox_addr_maxWidth) . str_repeat(" ", $rbtSt_billToBox_innerMargin) . substr($statementInfoArray['bill-to-code'], 0, $rbtSt_billToBox_acctNum_maxWidth) ;
I like how the concat operators are lined up and how it looks bracketed, but the naked semicolon on the following line makes me a little nervous. Putting it at the end of the line makes me even more nervous, since then it's hard to see.
It gets a little trickier when there's more nesting.
$rbt .= "\n" . str_repeat(" ", $rbtSt_billToBox_leadingWidth) . padBothAndTruncate( $statementInfoArray['bill-to-city'] . ", " . $statementInfoArray['bill-to-state'] . " " . $statementInfoArray['bill-to-zip'] ) ;
Do I always do multiple lines? Just when it is more than a certain number of characters (say, 120)? Once a statement is multiline, should I only have one operator per line?
I'm feeling a bit paralyzed by choices here and I fear that none of them are very good.