Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function build(ZoneInterface $zone)
 {
     $master = sprintf("\$ORIGIN %s\n\$TTL %s\n", $zone->getName(), $zone->getDefaultTtl());
     foreach ($zone->getResourceRecords() as $rr) {
         /* @var $rr ResourceRecord */
         $master .= sprintf("%s %s %s %s %s", $rr->getName(), $rr->getTtl(), $rr->getClass(), $rr->getType(), $rr->getRdata()->output());
         $master .= null == $rr->getComment() ? "\n" : sprintf("; %s\n", $rr->getComment());
     }
     return $master;
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function build(ZoneInterface $zone)
 {
     $master = '$ORIGIN ' . $zone->getName() . PHP_EOL . '$TTL ' . $zone->getDefaultTtl() . PHP_EOL;
     foreach ($zone->getResourceRecords() as $rr) {
         /* @var $rr ResourceRecord */
         if (null !== $rr->getRdata()) {
             $master .= preg_replace('/\\s+/', ' ', trim(sprintf('%s %s %s %s %s', $rr->getName(), $rr->getTtl(), $rr->getClass(), $rr->getType(), $rr->getRdata()->output())));
         }
         if (null !== $rr->getComment()) {
             $master .= ResourceRecord::COMMENT_DELIMINATOR . $rr->getComment();
         }
         $master .= PHP_EOL;
     }
     return $master;
 }