private function needsAdditionalRecords(Message $message): void
    {
        foreach ($message->getAnswers() as $answer) {
            $name = null;
            switch ($answer->getType()) {
                case RecordTypeEnum::TYPE_NS:
                    $name = $answer->getRdata();
                    break;
                case RecordTypeEnum::TYPE_MX:
                    $name = $answer->getRdata()['exchange'];
                    break;
                case RecordTypeEnum::TYPE_SRV:
                    $name = $answer->getRdata()['target'];
                    break;
            }

            if (null === $name) {
                continue;
            }

            $query = [
                (new ResourceRecord())
                    ->setQuestion(true)
                    ->setType(RecordTypeEnum::TYPE_A)
                    ->setName($name),

                (new ResourceRecord())
                    ->setQuestion(true)
                    ->setType(RecordTypeEnum::TYPE_AAAA)
                    ->setName($name),
            ];

            foreach ($this->resolver->getAnswer($query) as $additional) {
                $message->addAdditional($additional);
            }
        }
    }
private function needsAdditionalRecords(Message $message): void
    {
        foreach ($message->getAnswers() as $answer) {
            $name = null;
            switch ($answer->getType()) {
                case RecordTypeEnum::TYPE_NS:
                    $name = $answer->getRdata();
                    break;
                case RecordTypeEnum::TYPE_MX:
                    $name = $answer->getRdata()['exchange'];
                    break;
                case RecordTypeEnum::TYPE_SRV:
                    $name = $answer->getRdata()['target'];
                    break;
            }

            if (null === $name) {
                continue;
            }

            $query = [
                (new ResourceRecord())
                    ->setQuestion(true)
                    ->setType(RecordTypeEnum::TYPE_A)
                    ->setName($name),

                (new ResourceRecord())
                    ->setQuestion(true)
                    ->setType(RecordTypeEnum::TYPE_AAAA)
                    ->setName($name),
            ];

            foreach ($this->resolver->getAnswer($query) as $additional) {
                $message->addAdditional($additional);
            }
        }
    }
private function needsAdditionalRecords ( Message $ message ) : void { foreach ( $ message -> getAnswers ( ) as $ answer ) { $ name = null ; switch ( $ answer -> getType ( ) ) { case RecordTypeEnum :: TYPE_NS : $ name = $ answer -> getRdata ( ) ; break ; case RecordTypeEnum :: TYPE_MX : $ name = $ answer -> getRdata ( ) [ 'exchange' ] ; break ; case RecordTypeEnum :: TYPE_SRV : $ name = $ answer -> getRdata ( ) [ 'target' ] ; break ; } if ( null === $ name ) { continue ; } $ query = [ ( new ResourceRecord ( ) ) -> setQuestion ( true ) -> setType ( RecordTypeEnum :: TYPE_A ) -> setName ( $ name ) , ( new ResourceRecord ( ) ) -> setQuestion ( true ) -> setType ( RecordTypeEnum :: TYPE_AAAA ) -> setName ( $ name ) , ] ; foreach ( $ this -> resolver -> getAnswer ( $ query ) as $ additional ) { $ message -> addAdditional ( $ additional ) ; } } }
Populate the additional records of a message if required.

@param Message $message
Populate the additional records of a message if required .