public function getPrimaryRedirectUrl(Site $site)
    {
        $currentDomain = $site->getDomain()->getDomainName();

        $ipValidator = new Ip();
        $isIp = $ipValidator->isValid($currentDomain);

        if ($isIp) {
            return null;
        }

        $primaryDomain = $site->getDomain()->getPrimary();

        if (empty($primaryDomain)) {
            return null;
        }

        if ($primaryDomain->getDomainName() == $currentDomain) {
            return null;
        }

        return $primaryDomain->getDomainName();
    }
public function getPrimaryRedirectUrl(Site $site)
    {
        $currentDomain = $site->getDomain()->getDomainName();

        $ipValidator = new Ip();
        $isIp = $ipValidator->isValid($currentDomain);

        if ($isIp) {
            return null;
        }

        $primaryDomain = $site->getDomain()->getPrimary();

        if (empty($primaryDomain)) {
            return null;
        }

        if ($primaryDomain->getDomainName() == $currentDomain) {
            return null;
        }

        return $primaryDomain->getDomainName();
    }
public function getPrimaryRedirectUrl ( Site $ site ) { $ currentDomain = $ site -> getDomain ( ) -> getDomainName ( ) ; $ ipValidator = new Ip ( ) ; $ isIp = $ ipValidator -> isValid ( $ currentDomain ) ; if ( $ isIp ) { return null ; } $ primaryDomain = $ site -> getDomain ( ) -> getPrimary ( ) ; if ( empty ( $ primaryDomain ) ) { return null ; } if ( $ primaryDomain -> getDomainName ( ) == $ currentDomain ) { return null ; } return $ primaryDomain -> getDomainName ( ) ; }
getPrimaryRedirectUrl
If the IP is not a domain and is not the primary, return redirect for primary

@param Site $site

@return null|string
getPrimaryRedirectUrl If the IP is not a domain and is not the primary return redirect for primary