billingAddress; $attachPdfForAccount = $billingAddress->invoice_pdf_to_account ?? true; $invoiceEmail = trim((string) $billingAddress?->invoice_email); if ($invoiceEmail === '' || ! $billingAddress?->invoice_pdf_to_invoice_email) { return new self($attachPdfForAccount, null); } if (strcasecmp($invoiceEmail, trim((string) $user->email)) === 0) { return new self(true, null); } return new self($attachPdfForAccount, $invoiceEmail); } }