<?php

final class ExtensionStorePublicSite extends PhabricatorSite {

  public function getDescription() {
    return pht('Site for browsing Extension Store');
  }

  public function getPriority() {
    return 3000;
  }

  public function newSiteForRequest(AphrontRequest $request) {

    $host = $request->getHost();

    $configured_domain =
      PhabricatorEnv::getEnvConfig('extensionstore.domain-name');

    if ($host == $configured_domain) {
      return new self();
    }

  }

  public function getRoutingMaps() {
    $app = PhabricatorApplication::getByClass(
      ExtensionsStoreApplication::class);

    $maps = array();
    $maps[] = $this->newRoutingMap()
      ->setApplication($app)
      ->setRoutes(array('/' => $app->getStoreRoutes()));
    return $maps;

  }
}
