<?php

namespace MGModule\DNSManager2\mgLibs\custom\dns\record\type;

class TXT extends RecordTypeAbstract {
    /**
     * One or more <character-string>s.
     */
    public $txtdata;
    
    public function toString($only_this = array()) {
        return '"' . trim(htmlspecialchars_decode($this->txtdata,ENT_QUOTES), '"') . '"';
    }
    /**
     * @param string $txtdata needs to be string
     * @return bool
     */
    public function txtdataValidate($txtdata){
        return (bool)$txtdata;
    }

    public function unify()
    {
        //todo refactor
        $this->txtdata = str_replace('"', '', $this->txtdata);
        $this->txtdata = '"' . trim($this->txtdata, '"') . '"';
    }
}