/**
  * Be sure to have a full attributes set (add a title if needed)
  *
  * @param   array   $attributes     Passed by reference
  */
 protected function _validateLinkAttributes(array &$attributes, &$text)
 {
     if (isset($attributes['email'])) {
         list($address_link, $address_text) = Helper::encodeEmailAddress($attributes['email']);
         if (!isset($attributes['href']) || empty($attributes['href'])) {
             $attributes['href'] = $address_link;
         }
         if ($this->getConfig('mailto_title_mask') && empty($attributes['title'])) {
             $attributes['title'] = Helper::fillPlaceholders($this->getConfig('mailto_title_mask'), $address_text);
         }
         unset($attributes['email']);
         $text = $address_text;
     }
     if (empty($attributes['title']) && isset($attributes['href'])) {
         $first_char = substr($attributes['href'], 0, 1);
         if ($first_char === '#' && $this->getConfig('anchor_title_mask')) {
             $attributes['title'] = Helper::fillPlaceholders($this->getConfig('anchor_title_mask'), $attributes['href']);
         } elseif ($this->getConfig('link_title_mask')) {
             $attributes['title'] = Helper::fillPlaceholders($this->getConfig('link_title_mask'), !empty($attributes['href']) ? $attributes['href'] : '');
         }
     }
 }