12345678910111213141516171819202122232425262728293031323334 |
- <?php
-
- namespace App\Http\Business;
-
- use Luticate\Utils\LuBusiness;
- use App\Http\DataAccess\DnsDomainsDataAccess;
- use App\Http\DBO\DnsDomainsDbo;
-
- class DnsDomainsBusiness extends LuBusiness {
- protected static function getDataAccess()
- {
- return new DnsDomainsDataAccess();
- }
-
- public static function checkDomain(DnsDomainsDbo $domain)
- {
- if (is_null($domain->getName()) || !is_string($domain->getName())) {
- self::badInput("Name must be an string");
- }
- if (strtoupper($domain->getType()) != "MASTER" && strtoupper($domain->getType()) != "SLAVE") {
- self::badInput("Type must be SLAVE or MASTER");
- }
- $domain->setType(strtoupper($domain->getType()));
- $domain->setLastCheck(null);
- $domain->setNotifiedSerial(null);
- $domain->setAccount(null);
- }
-
- public static function add(DnsDomainsDbo $domain)
- {
- self::checkDomain($domain);
- return DnsDomainsDataAccess::addId($domain);
- }
- }
|