original_string: protected function get_categories() {
          global $DB;
          $fields = 'c.*, ' . context_helper::get_preload_record_columns_sql('ctx');
          $coursecats = $DB->get_records_sql('SELECT ' . $fields . ' FROM {course_categories} c
                  LEFT JOIN {context} ctx ON (ctx.instanceid = c.id AND ctx.contextlevel = :contextlevel)
                  WHERE c.parent = :parent ORDER BY c.sortorder',
              array('parent' => $this->category->id, 'contextlevel' => CONTEXT_COURSECAT));
  
          $hiddencats = [];
  
          foreach ($coursecats as $id => &$category) {
              context_helper::preload_from_record($category);
              if (!core_course_category::can_view_category($category)) {
                  $hiddencats[$id] = $coursecats[$id];
                  unset($coursecats[$id]);
              }
          }
          return [$coursecats, $hiddencats];
      }
code: protected function get_categories() {
          global $DB;
          $fields = 'c.*, ' . context_helper::get_preload_record_columns_sql('ctx');
          $coursecats = $DB->get_records_sql('SELECT ' . $fields . ' FROM {course_categories} c
                  LEFT JOIN {context} ctx ON (ctx.instanceid = c.id AND ctx.contextlevel = :contextlevel)
                  WHERE c.parent = :parent ORDER BY c.sortorder',
              array('parent' => $this->category->id, 'contextlevel' => CONTEXT_COURSECAT));
  
          $hiddencats = [];
  
          foreach ($coursecats as $id => &$category) {
              context_helper::preload_from_record($category);
              if (!core_course_category::can_view_category($category)) {
                  $hiddencats[$id] = $coursecats[$id];
                  unset($coursecats[$id]);
              }
          }
          return [$coursecats, $hiddencats];
      }
code_tokens: protected function get_categories ( ) { global $ DB ; $ fields = 'c.*, ' . context_helper :: get_preload_record_columns_sql ( 'ctx' ) ; $ coursecats = $ DB -> get_records_sql ( 'SELECT ' . $ fields . ' FROM {course_categories} c
                  LEFT JOIN {context} ctx ON (ctx.instanceid = c.id AND ctx.contextlevel = :contextlevel)
                  WHERE c.parent = :parent ORDER BY c.sortorder' , array ( 'parent' => $ this -> category -> id , 'contextlevel' => CONTEXT_COURSECAT ) ) ; $ hiddencats = [ ] ; foreach ( $ coursecats as $ id => & $ category ) { context_helper :: preload_from_record ( $ category ) ; if ( ! core_course_category :: can_view_category ( $ category ) ) { $ hiddencats [ $ id ] = $ coursecats [ $ id ] ; unset ( $ coursecats [ $ id ] ) ; } } return [ $ coursecats , $ hiddencats ] ; }
docstring: Finds accessible and non-accessible direct subcategories
  
  @return array [$coursecats, $hiddencats] - child categories that are visible to the current user and not visible
docstring_tokens: Finds accessible and non - accessible direct subcategories