sudo() public method

The closure sandbox will do a catch all on exceptions and rethrow after re-setting the sudo flag. Example use: $location = $repository->sudo( function ( Repository $repo ) use ( $locationId ) { return $repo->getLocationService()->loadLocation( $locationId ) } );
public sudo ( Closure $callback ) : mixed
$callback Closure
return mixed
 /**
  * Returns ContentType identifier based on $contentId.
  *
  * @param int|mixed $contentId
  *
  * @return string
  */
 private function getContentTypeIdentifier($contentId)
 {
     $contentTypeService = $this->repository->getContentTypeService();
     $contentService = $this->repository->getContentService();
     $contentType = $this->repository->sudo(function () use($contentId, $contentTypeService, $contentService) {
         $contentType = $contentTypeService->loadContentType($contentService->loadContent($contentId)->contentInfo->contentTypeId);
         return $contentType;
     });
     return $contentType->identifier;
 }