getRootIdFromUrl() public static method

Return the root page ID
Deprecation: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Frontend::getRootPageFromUrl()->id instead.
public static getRootIdFromUrl ( ) : integer
return integer
 /**
  * @param MessageContent $messageContent
  * @param array          $contents
  *
  * @return array
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 protected function handleFoundedContent(MessageContent $messageContent, array $contents)
 {
     if (count($contents) < 1) {
         return array();
     }
     $messageCategory = $messageContent->getMessage()->getCategory();
     $viewOnlinePageModel = \PageModel::findByPk($messageCategory->getViewOnlinePage());
     if (!$viewOnlinePageModel) {
         $viewOnlinePageModel = \PageModel::findByPk(Frontend::getRootIdFromUrl());
     }
     $viewOnlinePageModel->loadDetails();
     $replaced = array();
     $replacedIn = array();
     foreach ($contents as $content) {
         foreach (array('type', 'galleryTpl', 'customTpl', 'eventTemplate', 'newsTemplate') as $propertyTemplate) {
             if ($content instanceof \Model) {
                 if (empty($content->{$propertyTemplate})) {
                     continue;
                 }
                 $template = $this->findTemplate($content->{$propertyTemplate}, $messageCategory);
                 if ($content->{$propertyTemplate} === $template) {
                     continue;
                 }
                 $content->{$propertyTemplate} = $template;
                 $replaced[] = $template;
                 $replacedIn[] = $content;
             }
             if ($content instanceof EntityInterface) {
                 $getPropertyTemplate = 'get' . ucfirst($propertyTemplate);
                 $setPropertyTemplate = 'set' . ucfirst($propertyTemplate);
                 if (!method_exists($content, $getPropertyTemplate) || !$content->{$getPropertyTemplate}()) {
                     continue;
                 }
                 $template = $this->findTemplate($content->{$getPropertyTemplate}(), $messageCategory);
                 if ($content->{$getPropertyTemplate}() === $template) {
                     continue;
                 }
                 $content->{$setPropertyTemplate}($template);
                 $replaced[] = $template;
                 $replacedIn[] = $content;
             }
         }
     }
     return array($replaced, $replacedIn);
 }