code: public static function findVirtualHost(URL $url, array $sites)
      {
          foreach ($sites as $site)
          {
              $vhost = $site->match($url);
              if ($vhost !== null)
                  return $vhost;
          }
          return null;
      }
docs: Find the VirtualHost matching the provided URL.
  @param URL $url The URL to match
  @param array $sites A list of Site objects from which the correct
  VirtualHost should be extracted.
  @return VirtualHost The correct VirtualHost. Null if not found.