@param Item $item

@return Country
179584
public function addItem(Item $item)
    {
        if (!$this->items->contains($item)) {
            $this->items->add($item);
            $item->setCountry($this);
        }

        return $this;
    }
133635
public function ordinal($item)
    {
        $formatter = new NumberFormatter($this->config['locale'], NumberFormatter::ORDINAL);

        if (is_int($item)) {
            return $formatter->format($item);
        }

        return preg_replace_callback('/([0-9]+)/', function ($matches) use ($formatter) {
            return $formatter->format($matches[0]);
        }, $item);
    }
999958
protected function createH5PEntity( $item ) {
		$h5p = new \Pressbooks\Entities\Cloner\H5P();
		if ( isset( $item['id'] ) ) {
			$h5p->id = $item['id'];
		}
		if ( isset( $item['url'] ) ) {
			$h5p->url = $item['url'];
		}
		return $h5p;
	}
432632
protected function findOrCreateItem(array $item)
    {
        $entity = null;
        // If the table was not truncated to begin with, find current entity
        // first
        if (false === $this->truncate) {
            if (!empty($this->lookupFields)) {
                $lookupConditions = array();
                foreach ($this->lookupFields as $fieldName) {
                    $lookupConditions[$fieldName] = $item[$fieldName];
                }
                $entity = $this->entityRepository->findOneBy(
                    $lookupConditions
                );
            } else {
                $entity = $this->entityRepository->find(current($item));
            }
        }

        if (!$entity) {
            return $this->getNewInstance();
        }

        return $entity;
    }
1038729
public function remove( $item )
	{
		$index	= $this->getIndex( $item );
		unset( $this->list[$index] );
		return $this->write();
	}
526734
protected function indexItem(Item $item, $language = 0)
    {
        $itemIndexed = false;
        $documents = [];

        $itemDocument = $this->itemToDocument($item, $language);
        if (is_null($itemDocument)) {
            /*
             * If there is no itemDocument, this means there was no translation
             * for this record. This should not stop the current item to count as
             * being valid because not-indexing not-translated items is perfectly
             * fine.
             */
            return true;
        }

        $documents[] = $itemDocument;
        $documents = array_merge($documents, $this->getAdditionalDocuments($item, $language, $itemDocument));
        $documents = $this->processDocuments($item, $documents);
        $documents = $this->preAddModifyDocuments($item, $language, $documents);

        try {
            $response = $this->solr->getWriteService()->addDocuments($documents);
            if ($response->getHttpStatus() == 200) {
                $itemIndexed = true;
            }
        } catch (HttpException $e) {
            $response = new ResponseAdapter($e->getBody(), $httpStatus = 500, $e->getStatusMessage());
        }

        $this->log($item, $documents, $response);

        return $itemIndexed;
    }
1153130
protected function indexItem(Item $item, TypoScriptConfiguration $configuration)
    {
        $indexer = $this->getIndexerByItem($item->getIndexingConfigurationName(), $configuration);

        // Remember original http host value
        $originalHttpHost = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : null;

        $itemChangedDate = $item->getChanged();
        $itemChangedDateAfterIndex = 0;

        try {
            $this->initializeHttpServerEnvironment($item);
            $itemIndexed = $indexer->index($item);

            // update IQ item so that the IQ can determine what's been indexed already
            if ($itemIndexed) {
                $this->indexQueue->updateIndexTimeByItem($item);
                $itemChangedDateAfterIndex = $item->getChanged();
            }

            if ($itemChangedDateAfterIndex > $itemChangedDate && $itemChangedDateAfterIndex > time()) {
                $this->indexQueue->setForcedChangeTimeByItem($item, $itemChangedDateAfterIndex);
            }
        } catch (\Exception $e) {
            $this->restoreOriginalHttpHost($originalHttpHost);
            throw $e;
        }

        $this->restoreOriginalHttpHost($originalHttpHost);

        return $itemIndexed;
    }
218526
public function addItem(Item $item)
    {
        if (!$this->items->contains($item)) {
            $this->items->add($item);
            $item->addLabel($this);
        }

        return $this;
    }
1164334
public function makeFirst($item)
    {
        if (isset($this->items[$item])) {
            $this->items = [ $item => $this->items[$item] ] + $this->items;
        }

        return $this;
    }
925980
protected function convertItemToHash(Item $item)
    {
        $hash = array();

        foreach ($item->getState() as $propName => $propValue) {
            switch ($propName) {
                case 'blockId':
                case 'contentId':
                case 'locationId':
                case 'priority':
                case 'movedTo':
                case 'action':
                    if ($propValue !== null) {
                        $hash[$propName] = $propValue;
                    }
                    break;
                case 'attributes':
                    if ($propValue !== null && $propValue !== array()) {
                        $hash['attributes'] = $propValue;
                    }
                    break;
                case 'publicationDate':
                case 'visibilityDate':
                case 'hiddenDate':
                case 'rotationUntilDate':
                    if ($propValue !== null) {
                        /* @var $propValue \DateTime */
                        $hash[$propName] = $propValue->format(\DateTime::RFC850);
                    }
                    break;
            }
        }

        return $hash;
    }
1094382
public function getStore($item = null)
    {
        if (isset($item)) {
            return gplcart_array_get($this->current_store, $item);
        }

        return $this->current_store;
    }
125990
public function getItemPrice($item, $currency, $useProductPrice = true)
    {
        $currency = $this->getCurrency($currency);

        if ($useProductPrice) {
            $priceValue = $this->getValidProductPriceForItem($item, $currency);
         } else {
            $priceValue = $item->getPrice();
        }

        return $priceValue;
    }
780960
public function addItem(Item $item)
    {
        if (!$this->items->contains($item)) {
            $this->items->add($item);
            $item->addGenre($this);
        }

        return $this;
    }
490690
protected function addItem(Item $item, int $position = null): Item
	{
		/* @var $this IParent */
		$item->setParent($this);
		if ($position !== null) {
			Arrays::slice($this->items, $position, $item);
		} else {
			$this->items[] = $item;
		}
		return $item;
	}
459786
public function mapItem(PersistenceItem $item): Item
    {
        try {
            $itemDefinition = $this->itemDefinitionRegistry->getItemDefinition($item->valueType);
        } catch (ItemDefinitionException $e) {
            $itemDefinition = new NullItemDefinition($item->valueType);
        }

        $itemData = [
            'id' => $item->id,
            'status' => $item->status,
            'definition' => $itemDefinition,
            'collectionId' => $item->collectionId,
            'position' => $item->position,
            'value' => $item->value,
            'configs' => iterator_to_array(
                $this->configMapper->mapConfig(
                    $item->config,
                    $itemDefinition->getConfigDefinitions()
                )
            ),
            'cmsItem' => function () use ($item, $itemDefinition): CmsItemInterface {
                $valueType = $itemDefinition instanceof NullItemDefinition ? 'null' : $itemDefinition->getValueType();

                return $this->cmsItemLoader->load($item->value, $valueType);
            },
        ];

        return Item::fromArray($itemData);
    }
1352921
public function setItem(Item $item = null)
    {
        if ($this->item !== $item) {
            // romove link on this item for old item
            if ($this->item instanceof Item) {
                $tmp = $this->item;
                $this->item = null;
                $tmp->removeName($this);
            }
            $this->item = $item;
            // add link on this item
            if ($item instanceof Item) {
                $this->item->addName($this);
            }
        }

        return $this;
    }
1078635
protected function getFeeLine($item)
    {
        $feeEx = $item['line_total'];
        $feeVat = $item['line_tax'];

        $result = array(
                Tag::Product => $this->t($item['name']),
                Tag::UnitPrice => $feeEx,
                Meta::PrecisionUnitPrice => 0.01,
                Tag::Quantity => 1,
            ) + $this->getVatRangeTags($feeVat, $feeEx);

        return $result;
    }