sendNotification() public method

public sendNotification ( User $user, Invoice $invoice, $notificationType, Payment $payment = null )
$user app\models\User
$invoice app\models\Invoice
$notificationType
$payment app\models\Payment
 /**
  * @param $invoice
  * @param $type
  * @param null $payment
  */
 private function sendEmails($invoice, $type, $payment = null)
 {
     foreach ($invoice->account->users as $user) {
         if ($user->{"notify_{$type}"}) {
             $this->userMailer->sendNotification($user, $invoice, $type, $payment);
         }
     }
 }