original_string: public function getTargetPage(NewsCategoryModel $category)
      {
          $pageId = $category->jumpTo;
  
          // Inherit the page from parent if there is none set
          if (!$pageId) {
              $pid = $category->pid;
  
              do {
                  /** @var NewsCategoryModel $parent */
                  $parent = $category->findByPk($pid);
  
                  if (null !== $parent) {
                      $pid = $parent->pid;
                      $pageId = $parent->jumpTo;
                  }
              } while ($pid && !$pageId);
          }
  
          // Get the page model
          if ($pageId) {
              /** @var PageModel $pageAdapter */
              $pageAdapter = $this->framework->getAdapter(PageModel::class);
  
              return $pageAdapter->findPublishedById($pageId);
          }
  
          return null;
      }
code: public function getTargetPage(NewsCategoryModel $category)
      {
          $pageId = $category->jumpTo;
  
          // Inherit the page from parent if there is none set
          if (!$pageId) {
              $pid = $category->pid;
  
              do {
                  /** @var NewsCategoryModel $parent */
                  $parent = $category->findByPk($pid);
  
                  if (null !== $parent) {
                      $pid = $parent->pid;
                      $pageId = $parent->jumpTo;
                  }
              } while ($pid && !$pageId);
          }
  
          // Get the page model
          if ($pageId) {
              /** @var PageModel $pageAdapter */
              $pageAdapter = $this->framework->getAdapter(PageModel::class);
  
              return $pageAdapter->findPublishedById($pageId);
          }
  
          return null;
      }
code_tokens: public function getTargetPage ( NewsCategoryModel $ category ) { $ pageId = $ category -> jumpTo ; // Inherit the page from parent if there is none set if ( ! $ pageId ) { $ pid = $ category -> pid ; do { /** @var NewsCategoryModel $parent */ $ parent = $ category -> findByPk ( $ pid ) ; if ( null !== $ parent ) { $ pid = $ parent -> pid ; $ pageId = $ parent -> jumpTo ; } } while ( $ pid && ! $ pageId ) ; } // Get the page model if ( $ pageId ) { /** @var PageModel $pageAdapter */ $ pageAdapter = $ this -> framework -> getAdapter ( PageModel :: class ) ; return $ pageAdapter -> findPublishedById ( $ pageId ) ; } return null ; }
docstring: Get the category target page.
  
  @param NewsCategoryModel $category
  
  @return PageModel|null
docstring_tokens: Get the category target page .