Get Folder/File using Id.

@param string $itemId      Item id
@param bool   $getChildren Include children

@return array
164456
public function getItemById(string $itemId, bool $getChildren = false):array
    {
        $parameters = $getChildren === true ? '$expand=Children' : '';

        return $this->get("Items({$itemId})?{$parameters}");
    }
1107000
public function getById($id)
    {
        if ($this->id == $id) return $this;

        return $this->children->getById($id);
    }
733553
public function getItem($key, $itemId)
    {
        $dataset = $this->getDataset($key);

        foreach ($dataset as $item) {
            if ($item["id"] === $itemId) {
                return $item;
            }
        }
        return null;
    }
907191
private function getChildren($childNodes)
    {
        $uow = $this->dm->getUnitOfWork();
        $locale = $this->locale ?: $uow->getCurrentLocale($this->document);
        $uow->getPrefetchHelper()->prefetch($this->dm, $childNodes, $locale);

        $childDocuments = [];
        foreach ($childNodes as $childNode) {
            $childDocuments[$childNode->getName()] = $uow->getOrCreateProxyFromNode($childNode, $locale);
        }

        return $childDocuments;
    }
214316
public function getItem($itemId, $data = null)
	{
		$params = $this->setUpParams('item', $itemId, $data, 'itemListData', 'itemData');
		$array  = $this->makeRequest('item', $itemId, $params);

		if ($this->appendId($itemId))
		{
			return new staticItem($array);
		}
		else
		{
			return new ItemList($array);
		}
	}
1126978
def get_id2children(objs):
    """"""
    id2children = {}
    for obj in objs:
        _get_id2children(id2children, obj.item_id, obj)
    return id2children
1332120
public function get($itemsToGet = 0, $offset = 0)
    {
        $pages = [];
        if ($this->getQuery() == '') {
            $this->setBaseQuery();
        }

        $this->setItemsPerPage($itemsToGet);

        $r = parent::get($itemsToGet, $offset);
        foreach ($r as $row) {
            $nc = $this->loadPageID($row['cID'], 'ACTIVE');
            if (!$this->displayOnlyApprovedPages) {
                $cp = new Permissions($nc);
                if ($cp->canViewPageVersions()) {
                    $nc->loadVersionObject('RECENT');
                }
            }
            $nc->setPageIndexScore($row['cIndexScore']);
            $pages[] = $nc;
        }

        return $pages;
    }
845924
public function getChild($id)
    {
        if (array_key_exists($id, $this->children_by_id)) {
            return $this->children_by_id[$id];
        } else {
            return null;
        }
    }
825799
public function findItemsByItemTypeAndItemUid(string $itemType, int $itemUid) : array
    {
        $queryBuilder = $this->getQueryBuilder();
        $compositeExpression = $queryBuilder->expr()->andX(
            $queryBuilder->expr()->eq('item_type', $queryBuilder->getConnection()->quote($itemType, \PDO::PARAM_STR)),
            $queryBuilder->expr()->eq('item_uid', $itemUid)
        );
        return $this->getItemsByCompositeExpression($compositeExpression, $queryBuilder);
    }
944221
public function get_all_children_ids() {
        $children = [];
        $walk = [$this->id];
        while (count($walk) > 0) {
            $catid = array_pop($walk);
            $directchildren = self::get_tree($catid);
            if ($directchildren !== false && count($directchildren) > 0) {
                $walk = array_merge($walk, $directchildren);
                $children = array_merge($children, $directchildren);
            }
        }

        return $children;
    }
787043
public function get_active_instances($itemid) {
        global $DB;
        $conditions = array('definitionid'  => $this->definition->id,
                    'itemid' => $itemid,
                    'status'  => gradingform_instance::INSTANCE_STATUS_ACTIVE);
        $records = $DB->get_recordset('grading_instances', $conditions);
        $rv = array();
        foreach ($records as $record) {
            $rv[] = $this->get_instance($record);
        }
        $records->close();
        return $rv;
    }
842308
public function find($itemId)
    {
        foreach ($this->items as $item) {
            if ($itemId === $item->id) {
                return $item;
            }
        }

        return;
    }
1228880
public function getItems($itemName = null)
    {
        if ($itemName && isset($this->_items[$itemName])) {
            return $this->_items[$itemName];
        }

        return $this->_items;
    }
1202551
public function getChildOrganizations($parentId = null)
    {
        static $children;

        if (is_null($parentId)) {
            return array();
        }

        if (! isset($children[$parentId])) {
            $organizations = $this->db->fetchPairs(
                    'SELECT gor_id_organization, gor_name
                        FROM gems__organizations
                        WHERE gor_active=1 AND gor_has_login=1 AND
                            (gor_accessible_by LIKE ' . $this->db->quote('%:' . $parentId . ':%') . ' OR
                                gor_id_organization = ' . $this->db->quote($parentId) .  ')
                            ORDER BY gor_name');

            natsort($organizations);

            $children[$parentId] = $organizations;
        }

        return $children[$parentId];
    }
966292
public function get_old_parentid($itemname) {
        return array_key_exists($itemname, $this->elementsoldid) ? $this->elementsoldid[$itemname] : null;
    }
783608
public function getEnd($itemId)
    {
        $item = Item::findOrFail($itemId);

        if ($item->isEnded()) {
            return redirect('/item/'.$item->itemId);
        }

        return view('mustard::item.end', [
            'item' => $item,
        ]);
    }
928879
public function getCollectionChildrenArray($oneLevelOnly = 0)
    {
        $this->childrenCIDArray = [];
        $this->_getNumChildren($this->cID, $oneLevelOnly);

        return $this->childrenCIDArray;
    }