original_string: public function saveAttachment($attachment)
      {
          $binaryData = $attachment->getBinary();
          /** @var \Shockwavemk\Mail\Base\Model\Mail $mail */
          $mail = $attachment->getMail();
  
          $folderPath = $this->getMailFolderPathById($mail->getId()) .
              DIRECTORY_SEPARATOR .
              self::ATTACHMENT_PATH;
  
          // create a folder for message if needed
          $this->createFolder($folderPath);
  
          // try to store message to filesystem
          $filePath = $this->storeFile(
              $binaryData,
              $this->getMailFolderPathById($mail->getId()) .
                  DIRECTORY_SEPARATOR .
                  self::ATTACHMENT_PATH .
                  DIRECTORY_SEPARATOR .
                  basename($attachment->getFilePath())
          );
          
          $attachment->setFilePath($filePath);
      }
code: public function saveAttachment($attachment)
      {
          $binaryData = $attachment->getBinary();
          /** @var \Shockwavemk\Mail\Base\Model\Mail $mail */
          $mail = $attachment->getMail();
  
          $folderPath = $this->getMailFolderPathById($mail->getId()) .
              DIRECTORY_SEPARATOR .
              self::ATTACHMENT_PATH;
  
          // create a folder for message if needed
          $this->createFolder($folderPath);
  
          // try to store message to filesystem
          $filePath = $this->storeFile(
              $binaryData,
              $this->getMailFolderPathById($mail->getId()) .
                  DIRECTORY_SEPARATOR .
                  self::ATTACHMENT_PATH .
                  DIRECTORY_SEPARATOR .
                  basename($attachment->getFilePath())
          );
          
          $attachment->setFilePath($filePath);
      }
code_tokens: public function saveAttachment ( $ attachment ) { $ binaryData = $ attachment -> getBinary ( ) ; /** @var \Shockwavemk\Mail\Base\Model\Mail $mail */ $ mail = $ attachment -> getMail ( ) ; $ folderPath = $ this -> getMailFolderPathById ( $ mail -> getId ( ) ) . DIRECTORY_SEPARATOR . self :: ATTACHMENT_PATH ; // create a folder for message if needed $ this -> createFolder ( $ folderPath ) ; // try to store message to filesystem $ filePath = $ this -> storeFile ( $ binaryData , $ this -> getMailFolderPathById ( $ mail -> getId ( ) ) . DIRECTORY_SEPARATOR . self :: ATTACHMENT_PATH . DIRECTORY_SEPARATOR . basename ( $ attachment -> getFilePath ( ) ) ) ; $ attachment -> setFilePath ( $ filePath ) ; }
docstring: Save an attachment binary to a file in host temp folder
  
  @param \Shockwavemk\Mail\Base\Model\Mail\Attachment $attachment
  @return int $id
  @throws \Magento\Framework\Exception\FileSystemException
  @throws \Magento\Framework\Exception\MailException
  @throws \Exception
docstring_tokens: Save an attachment binary to a file in host temp folder