code: protected function findRealmFromUrl($url)
      {
          if (! isset($this->realms[$url->getHost()])) {
              return false;
          }
          foreach ($this->realms[$url->getHost()] as $name => $realm) {
              if ($realm->isWithin($url)) {
                  return $realm;
              }
          }
  
          return false;
      }
docs: Finds the name of the realm by comparing URLs.
  
  @param SimpleUrl $url        URL to test.
  
  @return SimpleRealm          Name of realm.