addressed CR notes: used PHP_EOL and split one string
addressed CR notes: added a constant with log label
addressed CR notes: removed unnecessary rtrim()
addressed CR notes: removed unnecessary else