@param $localId
@param int $itemType one of IAmazonReferenceId::TYPE_*

@return IAmazonReferenceId|null
426603
public function findFromLocalReferenceId($localId, $itemType)
    {
        /** @var $item IAmazonReferenceId */
        foreach ($this->idLists[$itemType] as $item) {
            if ($localId === $item->getLocalId()) {
                reset($this->idLists);

                return $item;
            }
        }

        return null;
    }
215708
public CmsTreeItem getChild(String itemId) {

        CmsTreeItem result = m_children.getItem(itemId);
        return result;
    }
97887
public function addCollectionItem($collectionId, $itemId, $itemType = 'video', $accessToken)
    {
        if (!$this->apiVersionIsGreaterThanV3()) {
            throw new EndpointNotSupportedByApiVersionException();
        }

        if (!is_string($itemId)) {
            throw new InvalidTypeException('Item ID', 'string', gettype($itemId));
        }

        if (!is_string($itemType)) {
            throw new InvalidTypeException('Item ID', 'string', gettype($itemType));
        }

        $params = [
            'item_id' => $itemId,
            'type' => $itemType,
        ];

        return $this->post(sprintf('collections/%s/items', $collectionId), $params, $accessToken);
    }
86629
protected function get_mappingid($itemname, $oldid, $ifnotfound = false) {
        return $this->step->get_mappingid($itemname, $oldid, $ifnotfound);
    }
709364
public function itemType() {
    $itemtype = $this->getAttribute('itemtype');
    if (!empty($itemtype)) {
      return $this->tokenList($itemtype);
    }
    // Return NULL instead of the empty string returned by getAttributes so we
    // can use the function for boolean tests.
    return NULL;
  }
755392
private function getItemContent(core_kernel_classes_Resource $itemResource, $langCode = '')
    {
        if ($this->isQtiItem($itemResource)) {
            $itemContent  = Service::singleton()
                ->getDataItemByRdfItem($itemResource, $langCode)
                ->toXML();
            if (!empty($itemContent)) {
                return simplexml_load_string($itemContent);
            }
        }

        return null;
    }
1309034
public static function getComments($itemId){
        $comments = Comment::where('item_id', $itemId)->orderBy('parent_id', 'asc')->get();

        foreach ($comments as $comment){
            $userId = $comment->user_id;
            $user = self::getUser($userId);
            $comment->name = $user['name'];
            $comment->email = $user['email'];
            $comment->url = $user['url'];

            if($user['avatar'] == 'gravatar'){
                $hash = md5(strtolower(trim($user['email'])));
                $comment->avatar = "http://www.gravatar.com/avatar/$hash?d=identicon";
            }
        }

        return $comments;
    }
465078
public static function is_enabled($component, $itemtype) {
        global $CFG;
        if (empty($CFG->usetags)) {
            return false;
        }
        $itemtypes = self::get_areas();
        if (isset($itemtypes[$itemtype][$component])) {
            return $itemtypes[$itemtype][$component]->enabled ? true : false;
        }
        return null;
    }
1306737
public function getReportField($itemType = 'Pages')
    {
        $params = isset($_REQUEST['filters']) ? $_REQUEST['filters'] : array();
        $items = $this->sourceRecords($params, null, null);

        $gridField = new GridFieldBasicContentReport('Report-' . $itemType, false, $items[$itemType]);

        $gridFieldConfig = GridFieldConfig::create()->addComponents(
            new GridFieldToolbarHeader(),
            new GridFieldSortableHeader(),
            new GridFieldDataColumns(),
            new GridFieldPaginator(),
            new GridFieldButtonRow('after'),
            $printButton = new GridFieldPrintButton('buttons-after-left'),
            $exportButton = new GridFieldExportButton('buttons-after-left')
        );

        $gridField->setConfig($gridFieldConfig);

        /* @var $columns GridFieldDataColumns */
        $columns = $gridField->getConfig()->getComponentByType(GridFieldDataColumns::class);

        $exportFields = [];
        $displayFields = [];
        $fieldCasting = [];
        $fieldFormatting = [];
        $dataFields = [];

        // Parse the column information
        foreach ($this->columns($itemType) as $source => $info) {
            if (is_string($info)) {
                $info = ['title' => $info];
            }

            if (isset($info['formatting'])) {
                $fieldFormatting[$source] = $info['formatting'];
            }
            if (isset($info['casting'])) {
                $fieldCasting[$source] = $info['casting'];
            }

            if (isset($info['link']) && $info['link']) {
                $fieldFormatting[$source] = function ($value, &$item) {
                    if ($item instanceof Page) {
                        return sprintf(
                            "<a href='%s'>%s</a>",
                            Controller::join_links(singleton(CMSPageEditController::class)->Link('show'), $item->ID),
                            $value
                        );
                    }

                    return sprintf(
                        '<a href="%s" target="_blank" rel="noopener">%s</a>',
                        Controller::join_links(
                            singleton(AssetAdmin::class)->Link('EditForm'),
                            'field/File/item',
                            $item->ID,
                            'edit'
                        ),
                        $value
                    );
                };
            }

            // Set custom datasource
            if (isset($info['datasource'])) {
                $dataFields[$source] = $info['datasource'];
            }

            // Set field name for export
            $fieldTitle = isset($info['title']) ? $info['title'] : $source;

            // If not print-only, then add to display list
            if (empty($info['printonly'])) {
                $displayFields[$source] = $fieldTitle;
            }

            // Assume that all displayed fields are printed also
            $exportFields[$source] = $fieldTitle;
        }

        // Set custom evaluated columns
        $gridField->addDataFields($dataFields);

        // Set visible fields
        $columns->setDisplayFields($displayFields);
        $columns->setFieldCasting($fieldCasting);
        $columns->setFieldFormatting($fieldFormatting);

        // Get print columns, and merge with print-only columns
        $printExportColumns = $this->getPrintExportColumns($gridField, $itemType, $exportFields);

        $printButton->setPrintColumns($printExportColumns);
        $exportButton->setExportColumns($printExportColumns);

        return $gridField;
    }
1173747
public function getItemViewType(string $itemViewType): ItemViewType
    {
        if (!$this->hasItemViewType($itemViewType)) {
            throw BlockDefinitionException::noItemViewType($this->identifier, $itemViewType);
        }

        return $this->itemViewTypes[$itemViewType];
    }
302545
public function item($modelName, $itemId = 0)
    {
        $bladeName = 'admin.model.pages.form';
        \View::composer($bladeName, ModelViewComposer::class);
        parent::item($modelName, $itemId);

        return $this->view = view($bladeName, $this->view->getData());
    }
1363761
public function retrieveItemPrices($itemsData, $currency, $locale)
    {
        $items = [];
        $previousItem = null;

        // Prepare item data.
        foreach ($itemsData as $itemData) {
            $useProductsPrice = false;
            if (isset($itemData['useProductsPrice']) && $itemData['useProductsPrice'] == true) {
                $useProductsPrice = $itemData['useProductsPrice'];
            }

            // Add and remove necessary data for calculation.
            $itemData = $this->setDefaultData($itemData);
            $itemData = $this->unsetUneccesaryData($itemData);

            // Generate item.
            /** @var ItemInterface $item */
            $item = $this->getItemManager()->save($itemData, $locale, null, null, null, null, $previousItem);
            $item->setUseProductsPrice($useProductsPrice);

            // Calculate total net price of item.
            $itemPrice = $this->itemPriceCalculator->calculateItemNetPrice(
                $item,
                $currency,
                $useProductsPrice,
                $this->isItemGrossPrice($itemData)
            );
            $itemTotalNetPrice = $this->itemPriceCalculator->calculateItemTotalNetPrice(
                $item,
                $currency,
                $useProductsPrice,
                $this->isItemGrossPrice($itemData)
            );
            $item->setPrice($itemPrice);
            $item->setTotalNetPrice($itemTotalNetPrice);

            // Save the last processed product item to calculate addon prices.
            if (Item::TYPE_ADDON !== $item->getType()) {
                $previousItem = $item->getEntity();
            }

            $items[] = $item;
        }

        return [
            'items' => $items,
        ];
    }
873688
public function updateItem($itemId, $data, $user = null, $locale = null)
    {
        $cart = $this->getUserCart($user, $locale);
        $userId = $user ? $user->getId() : null;

        $this->validateOrCreateAddresses($cart, $user);

        $item = $this->orderManager->getOrderItemById($itemId, $cart->getEntity());

        $this->orderManager->updateItem($item, $data, $locale, $userId);

        $this->removeOrderAddressIfContactAddressIdIsEqualTo(
            $item,
            $cart->getDeliveryAddress()->getContactAddress()->getId()
        );

        $this->orderManager->updateApiEntity($cart, $locale);

        return $cart;
    }
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);
    }
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);
		}
	}
199746
public function addItem(
        $itemData,
        $locale,
        $userId,
        OrderEntity $order,
        ItemInterface $lastProcessedProductItem = null
    ) {
        $item = $this->itemManager->save(
            $itemData,
            $locale,
            $userId,
            null,
            null,
            $order->getCustomerContact(),
            $lastProcessedProductItem
        );

        $order->addItem($item->getEntity());

        return $item;
    }
730638
protected function copyArrayType(ArrayType $arrayType, ObjectType $itemType) : ArrayType {
        return new ArrayType(
            $arrayType->getIterableKeyType(),
            $itemType,
            $arrayType->isItemTypeInferredFromLiteralArray(),
            $arrayType->isCallable()
        );
    }