Skip to content

Commit

Permalink
Apply php-cs-fixer changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dvesh3 authored and github-actions[bot] committed Mar 28, 2023
1 parent c424e03 commit f18221f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
7 changes: 3 additions & 4 deletions lib/Routing/Dynamic/DocumentRouteHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,13 @@ public function matchRequest(RouteCollection $collection, DynamicRequestContext
// If the request is not from a site and the document is part of a site
// or the ID of the requested site does not match the site where the document is located.
// Then we have to throw a NotFoundHttpException
if(!$site && $document && !Tool::isFrontendRequestByAdmin()) {
if (!$site && $document && !Tool::isFrontendRequestByAdmin()) {
$siteIdOfDocument = Frontend::getSiteIdForDocument($document);
if($siteIdOfDocument) {
throw new NotFoundHttpException("The page does not exist on this configured site.");
if ($siteIdOfDocument) {
throw new NotFoundHttpException('The page does not exist on this configured site.');
}
}


// check for a pretty url inside a site
if (!$document && $this->siteResolver->isSiteRequest($context->getRequest())) {
$sitePrettyDocId = $this->documentService->getDao()->getDocumentIdByPrettyUrlInSite($site, $context->getOriginalPath());
Expand Down
10 changes: 4 additions & 6 deletions lib/Tool/Frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

final class Frontend
{

public static function isDocumentInSite(?Site $site, Document $document): bool
{
$inSite = true;
Expand Down Expand Up @@ -54,12 +53,11 @@ public static function getSiteForDocument(Document $document): ?Site
{
$siteIdOfDocument = self::getSiteIdForDocument($document);

if(!$siteIdOfDocument) {
if (!$siteIdOfDocument) {
return null;
}

return Site::getById($siteIdOfDocument);

}

public static function getSiteIdForDocument(Document $document): ?int
Expand All @@ -75,17 +73,17 @@ public static function getSiteIdForDocument(Document $document): ?int
return null;
}

private static function getSiteMapping() : array
private static function getSiteMapping(): array
{
$cacheKey = 'sites_path_mapping';

if(RuntimeCache::isRegistered($cacheKey)) {
if (RuntimeCache::isRegistered($cacheKey)) {
return RuntimeCache::get($cacheKey);
}

$siteMapping = Pimcore\Cache::load($cacheKey);

if(!$siteMapping) {
if (!$siteMapping) {
$siteMapping = [];
$sites = new Site\Listing();
$sites->setOrderKey('(SELECT LENGTH(`path`) FROM documents WHERE documents.id = sites.rootId) DESC', false);
Expand Down

0 comments on commit f18221f

Please sign in to comment.