AfriCC/php-epp2

set only one contact type (local/international)

Closed this issue · 3 comments

in the Create Contact . the class add two type of contact (loc/int) . we can allow creation of "loc" contact only by the function skipInt() , but we can't allow creation of "int" only .

it better to add a new function like forceIntOnly() like

public function forceIntOnly()
{
    $this->force_ascii = false;
    $this->skip_int = false;
    $this->force_int = true;
}

and update the ContactTrait class to use this new fucntion , something like

public function appendName($path, $name)
{
    if ($this->force_ascii) {
        $this->set(sprintf($path, 'loc'), Translit::transliterate($name));
    } else  if (!$this->skip_int) {
        $this->set(sprintf($path, 'int'), Translit::transliterate($name));
    } else if ($this->force_int) {
        $this->set(sprintf($path, 'int'), ($name));
   } else {
        $this->set(sprintf($path, 'loc'), $name);
  }

}

Sounds like something that should be added - out of curiosity, which TLD requires only int?

we will see this in next release ?
in general , all tld require at least 1 contact , is no sense to have the same contact in (loc/int) , is like duplicated info .

also with be better to add this option as a setting in the client instance


$epp_client = new EPPClient([
    'host' => 'epptest.org',
    'username' => 'foo',
    'password' => 'bar',
    'services' => [
        'urn:ietf:params:xml:ns:domain-1.0',
        'urn:ietf:params:xml:ns:contact-1.0'
    ],
    'debug' => true,
    'contact_type' => array("loc") , // array("loc","int")
]);

Sorry for the delays and thanks again for your input @naja7host - it is implemented via #46

Some notes though:

  1. having int + loc is according to the spec: https://tools.ietf.org/html/rfc5733#section-3.2.1 - they do differ a little, that is int can only contain ascii, while loc may contain characters outside of ascii (within utf8)
  2. it shouldn't be a problem on document size to have both in, but lemme know if you are hitting a edge case where that is important
  3. forget about force_ascii - that is really only meant for buggy registries ;)
  4. finally, from now you can just use $frame->skiptLoc() - it is not a config option because it only applies to few frames and because not wanting loc is relatively out-of-spec so imho an edge case