original_string: public function sendAdvertPurchaseConfirmationMessage(Invoice $invoice, $amount)
      {
          //send email to optic to confirm plan purchase
          //check empty bank number account
          $templateName = 'PaymentBundle:Email:advert.confirmation.html.twig';
          $advert = $invoice->getTransaction()->getItems()->first()->getAdvert();
          
          if($invoice->getTransaction()->getActor() instanceof Actor){
              $user = $invoice->getTransaction()->getActor();
          }elseif($invoice->getTransaction()->getOptic() instanceof Optic){
              $user = $invoice->getTransaction()->getOptic();
          }
              
          $toEmail = $user->getEmail();
          $token = null;
              
           $context = array(
              'order_number' => $invoice->getTransaction()->getTransactionKey(),
              'advert' => $advert,
              'user' => $user,
              'token' => $token
          );
          
          $this->sendMessage($templateName, $context, $this->twigGlobal->getParameter('admin_email') , $toEmail);
          
      }
code: public function sendAdvertPurchaseConfirmationMessage(Invoice $invoice, $amount)
      {
          //send email to optic to confirm plan purchase
          //check empty bank number account
          $templateName = 'PaymentBundle:Email:advert.confirmation.html.twig';
          $advert = $invoice->getTransaction()->getItems()->first()->getAdvert();
          
          if($invoice->getTransaction()->getActor() instanceof Actor){
              $user = $invoice->getTransaction()->getActor();
          }elseif($invoice->getTransaction()->getOptic() instanceof Optic){
              $user = $invoice->getTransaction()->getOptic();
          }
              
          $toEmail = $user->getEmail();
          $token = null;
              
           $context = array(
              'order_number' => $invoice->getTransaction()->getTransactionKey(),
              'advert' => $advert,
              'user' => $user,
              'token' => $token
          );
          
          $this->sendMessage($templateName, $context, $this->twigGlobal->getParameter('admin_email') , $toEmail);
          
      }
code_tokens: public function sendAdvertPurchaseConfirmationMessage ( Invoice $ invoice , $ amount ) { //send email to optic to confirm plan purchase //check empty bank number account $ templateName = 'PaymentBundle:Email:advert.confirmation.html.twig' ; $ advert = $ invoice -> getTransaction ( ) -> getItems ( ) -> first ( ) -> getAdvert ( ) ; if ( $ invoice -> getTransaction ( ) -> getActor ( ) instanceof Actor ) { $ user = $ invoice -> getTransaction ( ) -> getActor ( ) ; } elseif ( $ invoice -> getTransaction ( ) -> getOptic ( ) instanceof Optic ) { $ user = $ invoice -> getTransaction ( ) -> getOptic ( ) ; } $ toEmail = $ user -> getEmail ( ) ; $ token = null ; $ context = array ( 'order_number' => $ invoice -> getTransaction ( ) -> getTransactionKey ( ) , 'advert' => $ advert , 'user' => $ user , 'token' => $ token ) ; $ this -> sendMessage ( $ templateName , $ context , $ this -> twigGlobal -> getParameter ( 'admin_email' ) , $ toEmail ) ; }
docstring: Send plan purchase confirmation
  
  @param Invoice $invoice
  @param float   $amount
docstring_tokens: Send plan purchase confirmation