/**
  * Checks a CNAME record for validity.
  *
  * @param Records    $record
  *
  * @return bool
  */
 public function _validateCname(Records $record)
 {
     $name = $record->getName();
     $looseHostname = 0 == $record->getLooseCheck() ? false : true;
     if (0 != strlen($name)) {
         if (false === $looseHostname) {
             if (false === strpos($name, '.' . $record->getDomain()->getName())) {
                 $this->context->addViolationAt('name', 'Name: ' . $name . ' is not in domain: ' . $record->getDomain()->getName(), array(), null);
             } else {
                 if (!$this->_checkHostname($name, false, true, true, $looseHostname)) {
                     $this->context->addViolationAt('name', 'Name: ' . $name . ' is not a valid hostname', array(), null);
                 }
             }
         }
     }
     if (!$this->_checkHostname($record->getContent(), false, true, true, $looseHostname)) {
         $this->context->addViolationAt('content', 'Name: ' . $record->getContent() . ' is not a valid hostname', array(), null);
     }
     return true;
 }