/** * Checks a given Domain Name to be syntactically correct regarding the naming rules * in the relevant RFCs. * * @param string $domainName the domain name to validate * @return bool the result of the validation, TRUE if all is fine, FALSE otherwise */ protected function isValid($domainName) { $this->domainNameToCheck = $this->idnaConvertService->encodeUmlautDomainName($domainName); if ($this->checkForValidNumberOfLabels() && $this->checkForValidLengthOfSingleLabels() && $this->checkLength() && $this->checkForAtLeastOneDot() && $this->checkForAllowedCharacters() && $this->checkForNumberOnlyLabels() && $this->checkForDashesAtBeginEndOfLabels()) { // all seems to be fine return TRUE; } else { // TODO: Find a nicer solution. Currently the translator cannot be injected properly during unit-tests if ($this->isSilentModeActive === TRUE) { $this->addError('invalid domain name', 1409169479); } else { $this->addError($this->translator->translateById('message.error_invalid_domain_name', array(), NULL, NULL, 'Domain', 'Roketi.Panel'), 1403357765); } return FALSE; } }
/** * Sets the original domain name - may include umlauts in the domain name. * @param string $name * @return void */ public function setName($name) { $this->name = $name; $this->punycodeName = $this->idnaConvertService->encodeUmlautDomainName($name); }