original_string: protected function getCategories()
      {
          $customCategories = $this->news_customCategories ? StringUtil::deserialize($this->news_categories, true) : [];
  
          // Get the subcategories of custom categories
          if (\count($customCategories) > 0) {
              $customCategories = NewsCategoryModel::getAllSubcategoriesIds($customCategories);
          }
  
          // Get all categories whether they have news or not
          if ($this->news_showEmptyCategories) {
              if (\count($customCategories) > 0) {
                  $categories = NewsCategoryModel::findPublishedByIds($customCategories);
              } else {
                  $categories = NewsCategoryModel::findPublished();
              }
          } else {
              // Get the categories that do have news assigned
              $categories = NewsCategoryModel::findPublishedByArchives($this->news_archives, $customCategories);
          }
  
          return $categories;
      }
code: protected function getCategories()
      {
          $customCategories = $this->news_customCategories ? StringUtil::deserialize($this->news_categories, true) : [];
  
          // Get the subcategories of custom categories
          if (\count($customCategories) > 0) {
              $customCategories = NewsCategoryModel::getAllSubcategoriesIds($customCategories);
          }
  
          // Get all categories whether they have news or not
          if ($this->news_showEmptyCategories) {
              if (\count($customCategories) > 0) {
                  $categories = NewsCategoryModel::findPublishedByIds($customCategories);
              } else {
                  $categories = NewsCategoryModel::findPublished();
              }
          } else {
              // Get the categories that do have news assigned
              $categories = NewsCategoryModel::findPublishedByArchives($this->news_archives, $customCategories);
          }
  
          return $categories;
      }
code_tokens: protected function getCategories ( ) { $ customCategories = $ this -> news_customCategories ? StringUtil :: deserialize ( $ this -> news_categories , true ) : [ ] ; // Get the subcategories of custom categories if ( \ count ( $ customCategories ) > 0 ) { $ customCategories = NewsCategoryModel :: getAllSubcategoriesIds ( $ customCategories ) ; } // Get all categories whether they have news or not if ( $ this -> news_showEmptyCategories ) { if ( \ count ( $ customCategories ) > 0 ) { $ categories = NewsCategoryModel :: findPublishedByIds ( $ customCategories ) ; } else { $ categories = NewsCategoryModel :: findPublished ( ) ; } } else { // Get the categories that do have news assigned $ categories = NewsCategoryModel :: findPublishedByArchives ( $ this -> news_archives , $ customCategories ) ; } return $ categories ; }
docstring: Get the categories
  
  @return Collection|null
docstring_tokens: Get the categories