/**
  * Embed the image in message and replace the image link by attachment id.
  *
  * @param \Swift_Message $message The swift mailer message
  * @param \DOMAttr       $node    The dom attribute of image
  * @param array          $images  The map of image ids passed by reference
  */
 protected function embedImage(\Swift_Message $message, \DOMAttr $node, array &$images)
 {
     if (0 === strpos($node->nodeValue, 'cid:')) {
         return;
     }
     if (isset($images[$node->nodeValue])) {
         $node->nodeValue = $images[$node->nodeValue];
     } else {
         $node->nodeValue = EmbedImageUtil::getLocalPath($node->nodeValue, $this->webDir, $this->hostPattern);
         $cid = $message->embed(\Swift_Image::fromPath($node->nodeValue));
         $images[$node->nodeValue] = $cid;
         $node->nodeValue = $cid;
     }
 }
 /**
  * @dataProvider getLocalePathData
  *
  * @param string $path
  * @param string $webDir
  * @param string $hostPattern
  * @param string $valid
  */
 public function testGetLocalPath($path, $webDir, $hostPattern, $valid)
 {
     $this->assertSame($valid, EmbedImageUtil::getLocalPath($path, $webDir, $hostPattern));
 }