Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

DnsDomainsBusiness.php 1012B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace App\Http\Business;
  3. use Luticate\Utils\LuBusiness;
  4. use App\Http\DataAccess\DnsDomainsDataAccess;
  5. use App\Http\DBO\DnsDomainsDbo;
  6. class DnsDomainsBusiness extends LuBusiness {
  7. protected static function getDataAccess()
  8. {
  9. return new DnsDomainsDataAccess();
  10. }
  11. public static function checkDomain(DnsDomainsDbo $domain)
  12. {
  13. if (is_null($domain->getName()) || !is_string($domain->getName())) {
  14. self::badInput("Name must be an string");
  15. }
  16. if (strtoupper($domain->getType()) != "MASTER" && strtoupper($domain->getType()) != "SLAVE") {
  17. self::badInput("Type must be SLAVE or MASTER");
  18. }
  19. $domain->setType(strtoupper($domain->getType()));
  20. $domain->setLastCheck(null);
  21. $domain->setNotifiedSerial(null);
  22. $domain->setAccount(null);
  23. }
  24. public static function add(DnsDomainsDbo $domain)
  25. {
  26. self::checkDomain($domain);
  27. return DnsDomainsDataAccess::addId($domain);
  28. }
  29. }