function GetTile()
 {
     $wmsRequest = new lizmapWMTSRequest($this->project, $this->params);
     $result = $wmsRequest->process();
     $rep = $this->getResponse('binary');
     $rep->mimeType = $result->mime;
     $rep->content = $result->data;
     $rep->doDownload = false;
     $rep->outputFileName = 'qgis_server_wmts_tile_' . $this->repository->getKey() . '_' . $this->project->getKey();
     $rep->setHttpStatus($result->code, '');
     if (!preg_match('/^image/', $result->mime)) {
         return $rep;
     }
     // HTTP browser cache expiration time
     $layername = $this->params["layer"];
     $lproj = $this->project;
     $configLayers = $lproj->getLayers();
     if (property_exists($configLayers, $layername)) {
         $configLayer = $configLayers->{$layername};
         if (property_exists($configLayer, 'clientCacheExpiration')) {
             $clientCacheExpiration = (int) $configLayer->clientCacheExpiration;
             $rep->setExpires("+" . $clientCacheExpiration . " seconds");
         }
     }
     lizmap::logMetric('LIZMAP_SERVICE_GETMAP');
     return $rep;
 }
 /**
  * Get a project
  */
 public static function getProject($key)
 {
     $match = preg_match('/(?P<rep>\\w+)~(?P<proj>\\w+)/', $key, $matches);
     if ($match != 1) {
         return null;
     }
     $rep = self::getRepository($matches['rep']);
     if ($rep == null) {
         return null;
     }
     jClasses::inc('lizmap~lizmapProject');
     $proj = new lizmapProject($matches['proj'], $rep);
     if ($proj->getKey() != $matches['proj']) {
         return null;
     }
     return $proj;
 }