Last active
February 3, 2022 17:41
-
-
Save ngallazzi/72103b32863e2365398d4c617cddd115 to your computer and use it in GitHub Desktop.
Mastering refactoring - Inline function, starting code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun printInvoiceSheet(invoice: Invoice) { | |
printInvoiceHeader(invoice) | |
val fullName = getFullName(invoice) | |
binding.tvInvoicePreview.append(fullName) | |
val address = getAddress(invoice) | |
binding.tvInvoicePreview.append(address) | |
} | |
private fun getFullName(invoice: Invoice): String { | |
val fullName = | |
"First Name: ${invoice.customer.firstName}\nLast Name: ${invoice.customer.lastName}\n" | |
return fullName | |
} | |
private fun getAddress(invoice: Invoice) : String { | |
val address = "Address: ${invoice.customer.address}\n" | |
return address | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment