Returns true if the category has already been loaded as have any child categories

@param int $categoryid
@return bool
551869
protected function is_category_fully_loaded($categoryid) {
        return (array_key_exists($categoryid, $this->addedcategories) && ($this->allcategoriesloaded || $this->addedcategories[$categoryid]->children->count() > 0));
    }
756641
private function isCategoryDeletable($intId)
  {
    $params = new \DmsLoaderParams();
    $params->rootCategoryId = $intId;
    $params->includeRootCategory = true;
    $params->loadRootCategory = true;
    $params->loadAccessRights = true;
    $params->loadDocuments = true;

    $dmsLoader = \DmsLoader::getInstance();
    $arrCategories = $dmsLoader->loadCategories($params);

    if (count($arrCategories) == 1)
    {
      $category = $arrCategories[0];
      if ($category != null && ($category->hasDocuments() || $category->hasDocumentsInSubCategories()))
      {
        return false;
      }
    }
    return true;
  }
609981
public function getRoot($categoryId)
    {
        $category = CategoryQuery::create()->findPk($categoryId);

        if (0 !== $category->getParent()) {
            $parentCategory = CategoryQuery::create()->findPk($category->getParent());

            if (null !== $parentCategory) {
                $categoryId = $this->getRoot($parentCategory->getId());
            }
        }

        return $categoryId;
    }
591605
private function getCategory($categoryId)
    {
        if (!array_key_exists($categoryId, $this->categories)) {
            $categoryCollection = $this->categoryCollectionFactory->create();
            foreach ($categoryCollection as $category) {
                $this->categories[$category->getId()] = $category;
            }
        }

        return $this->categories[$categoryId];
    }
562822
protected function _getChildrenCategoryIds($categoryId)
    {
        //brak kategorii
        if (null === ($chosenLabel = isset($this->_flatTree[$categoryId]) ? $this->_flatTree[$categoryId] : null)) {
            return [];
        }
        $categories = [];
        //iteracja po spłaszczonym drzewie
        foreach ($this->_flatTree as $id => $label) {
            //porównywanie labelki wzorcowek
            if ($chosenLabel == substr($label, 0, strlen($chosenLabel))) {
                //zgodny - dodwanie identyfikatora do listy
                $categories[$id] = $id;
            }
        }
        //zwrot identyfikatorów kategorii
        return $categories;
    }
648881
public function hasItem($cacheId)
    {
        $cacheId = $this->normalizeKey($cacheId);

        try {
            return ($this->cache->countDataItems($cacheId) > 0);
        } catch (ezcBaseException $ex) {
            return false;
        }
    }
1329515
public function delete_category($categoryid) {
        global $CFG, $DB;
        question_can_delete_cat($categoryid);
        if (!$category = $DB->get_record("question_categories", array("id" => $categoryid))) {  // security
            print_error('unknowcategory');
        }
        /// Send the children categories to live with their grandparent
        $DB->set_field("question_categories", "parent", $category->parent, array("parent" => $category->id));

        /// Finally delete the category itself
        $DB->delete_records("question_categories", array("id" => $category->id));

        // Log the deletion of this category.
        $event = \core\event\question_category_deleted::create_from_question_category_instance($category);
        $event->add_record_snapshot('question_categories', $category);
        $event->trigger();

    }
1131878
public function childrenOf($category_id, int $limit = 50, $columns = 'id')
    {
        $key = md5(vsprintf('%s', ['children_of_category']));

        return Cache::remember($key, 25, function () use ($category_id, $limit, $columns) {
            return $this->next->childrenOf($category_id, $limit, $columns);
        });
    }
912064
public static function get_category_children_visibility($categoryid) {
        global $DB;
        $category = \core_course_category::get($categoryid);
        $select = $DB->sql_like('path', ':path');
        $path = $category->path . '/%';

        $sql = "SELECT c.id, c.visible
                  FROM {course_categories} c
                 WHERE ".$select;
        $params = array('path' => $path);
        return $DB->get_records_sql($sql, $params);
    }
745911
public function getCategoryTree($categoryId = null)
    {
        $method = 'category_tree';

        if ($categoryId !== null) {
            $method .= '/'.$categoryId;
        }

        return $this->call($method);
    }
482071
public function getChildrenCount($categoryId)
    {
        $select = $this->getConnection()->select()->from(
            $this->getEntityTable(),
            'children_count'
        )->where(
            'entity_id = :entity_id'
        );
        $bind = ['entity_id' => $categoryId];

        return $this->getConnection()->fetchOne($select, $bind);
    }
1068491
public function hasChildNodes($dsId = null)
    {
        if (!$dsId) {
            // use root as default
            $dsId = $this->rootDsId;
        }

        $childrenDsIds = $this->getChildrenDsIds($dsId);
        $hasChildren = count($childrenDsIds) > 0;

        return $hasChildren;
    }
195184
private function SaveCategoryPage($categoryID)
    {
        $category = Category::Schema()->ByID($categoryID);
        if ($category) {
            $category->SetPage($this->Page());
            $category->Save();
        }
    }
1184098
public function deleteByCategoryId(int $categoryId)
    {
        $deleteCondition = [sprintf("%s = ?", $this->getIdFieldName()) => $categoryId];

        return (bool) $this->getConnection()->delete($this->getMainTable(), $deleteCondition);
    }
862599
public function childrenOf($category_id, int $limit = 50, $columns = '*')
    {
        return Category::select($columns)->with('childrenRecursive')
            ->where('category_id', $category_id)
            ->orderBy('updated_at', 'desc')
            ->take($limit)
            ->get();
    }
1353118
public function isUserAllowedNewsCategory($categoryId)
    {
        if (null === ($roots = $this->getUserAllowedRoots())) {
            return true;
        }

        /** @var Database $db */
        $db = $this->framework->createInstance(Database::class);

        $ids = $db->getChildRecords($roots, 'tl_news_category', false, $roots);
        $ids = \array_map('intval', $ids);

        return \in_array((int) $categoryId, $ids, true);
    }
1007553
private function getCategoryNameById($categoryId, $storeId)
    {
        if (!isset($this->categoryNames[$categoryId])) {
            $categoryResource = $this->categoryResource;
            $this->categoryNames[$categoryId] = $categoryResource->getAttributeRawValue($categoryId, "name", $storeId);
        }

        return $this->categoryNames[$categoryId];
    }