Neos.Neos/Classes/Domain/Repository/DomainRepository.php
public function findOneByHost($hostname, $onlyActive = false)
    {
        $allMatchingDomains = $this->findByHost($hostname, $onlyActive);
        return count($allMatchingDomains) > 0 ? $allMatchingDomains[0] : null;
    }
public function findOneByHost($hostname, $onlyActive = false)
    {
        $allMatchingDomains = $this->findByHost($hostname, $onlyActive);
        return count($allMatchingDomains) > 0 ? $allMatchingDomains[0] : null;
    }
public function findOneByHost ( $ hostname , $ onlyActive = false ) { $ allMatchingDomains = $ this -> findByHost ( $ hostname , $ onlyActive ) ; return count ( $ allMatchingDomains ) > 0 ? $ allMatchingDomains [ 0 ] : null ; }
Find the best matching active domain for the given hostname.

@param string $hostname Hostname the domain should match with (eg. "localhost" or "www.neos.io")
@param boolean $onlyActive Only include active domains
@return Domain
@api
Find the best matching active domain for the given hostname .