Compares the items
@param NavigationItem $item1
@param NavigationItem $item2
775836
public function Equals($item1, $item2)
    {
        if ($item1 === null && $item2 !== null)
        {
            return false;
        }
        else if ($item1 !== null && $item2 === null)
        {
            return false;
        }
        else if ($item1 === null && $item2 === null)
        {
            return true;
        }
        return $item1->Equals($item2);
    }
159131
public function matchItem(ItemInterface $item)
    {
        $request = $this->requestStack->getCurrentRequest();

        $parent = $item->getParent();

        while (null !== $parent->getParent()) {
            $parent = $parent->getParent();
        }

        if ($item->getUri() === $request->getRequestUri() or
            $item->getUri() === $request->attributes->get('__current_folder_path', false)
        ) {
            // URL's completely match
            return true;
        } elseif (
            $item->getUri() !== $request->getBaseUrl().'/' and
            $item->getUri() !== $request->getBaseUrl().'/admin/' and
            $item->getUri() === substr($request->getRequestUri(), 0, strlen($item->getUri())) and
            $request->attributes->get('__selected_inheritance', true) and
            $parent->getExtra('select_intehitance', true)
        ) {
            // URL isn't just "/" and the first part of the URL match
            return true;
        }

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

        return $this;
    }
1170352
public function addItem(OrderingItem $item)
    {
        if (!$this->items->contains($item)) {
            $item->setQuestion($this);
            $this->items->add($item);
        }
    }
381140
private function verifyItemExistenceInSubItemList(string $itemName, string $itemType, string $containerName, bool $itemShouldExist): void
    {
        $isItemInTable = PageObjectFactory::createPage($this->utilityContext, ContentItemPage::PAGE_NAME, $containerName)
            ->subItemList->table->isElementInTable($itemName, $itemType);

        $itemShouldExistString = $itemShouldExist ? '' : 'n\'t';

        if ($isItemInTable !== $itemShouldExist) {
            Assert::fail(sprintf('%s "%s" should%s be on %s Sub-items list', $itemType, $itemName, $itemShouldExistString, $containerName));
        }
    }
514970
private function processNavigationItem(NavigationItem $navigationItem): void
    {
        // create label from name when no label is set
        if (!$navigationItem->getLabel()) {
            $navigationItem->setLabel($this->translator->trans($navigationItem->getName(), [], 'admin'));
        }

        // add child routes
        if ($navigationItem->getMainRoute()) {
            $mainPath = $this->routeRegistry->findRouteByName($navigationItem->getMainRoute())->getPath();
            foreach ($this->routeRegistry->getRoutes() as $route) {
                if (false !== strpos($route->getPath(), $mainPath)) {
                    $navigationItem->addChildRoute($route->getName());
                }
            }
        }

        // process all children
        foreach ($navigationItem->getChildren() as $child) {
            $this->processNavigationItem($child);
        }
    }
1298022
public function validate($itemLabel, $itemValue)
    {
        $this->currentKey = $itemLabel;
        $item = new Item($itemLabel, $itemValue);
        $this->items[$itemLabel] = $item;

        return $this;
    }
996732
protected function checkType($item)
    {
        $type = $this->getItemType($item);
        if (! $this->type) {
            $this->type = $type;

            return true;
        }

        if ($this->type != $type) {
            return false;
        }

        return true;
    }
737877
public function ItemEqual( $item1, $item2 )
	{
		if ( $item1 instanceof DOMXPathNavigator &&
			 $item1->getNamespaceURI() == \XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_XBRLI ] &&
			 ( $item1->getLocalName() == 'instant' || $item1->getLocalName() == 'endDate' ) )
		{
			// Parent MUST be period
			$parent = $item1->CloneInstance();
			if ( $parent->MoveToParent() )
			{
				if ( $parent->getLocalName() == 'period' )
				{
					// OK, got two dates.  If one has the format <date>T<time> and the other does not then compare them carefully.
					$item1Value = trim( $item1->getValue() );
					$item2Value = trim( $item2->getValue() );
					if ( ( strpos( $item1Value, "T" ) !== false && strpos( $item2Value, "T" ) === false ) ||
						 ( strpos( $item2Value, "T" ) !== false && strpos( $item1Value, "T" ) === false )
					)
					{
						$item1 = $item1->getTypedValue();
						$item2 = $item2->getTypedValue();

						// One of the values has a 'T' format.  If one of them has 00:00:00 then create a revised date
						if ( strpos( $item1Value, "00:00:00" ) !== false )
						{
							$item1 = DateTimeValue::AddDayTimeDuration( $item1, DayTimeDurationValue::Parse("-P1D") );
							$item1 = DateValue::fromDate( $item1->S, $item1->getValue(), ! $item1->IsLocal );
						}
						else if ( strpos( $item2Value, "00:00:00" ) !== false )
						{
							$item2 = DateTimeValue::AddDayTimeDuration( $item2, DayTimeDurationValue::Parse("-P1D") );
							$item2 = DateValue::fromDate( $item2->S, $item2->getValue(), ! $item2->IsLocal );
						}

						$item1 = XPath2Item::fromValue( $item1 );
						$item2 = XPath2Item::fromValue( $item2 );
					}
				}
			}
		}

		return parent::ItemEqual( $item1, $item2 );
	}
959798
public function DeepEqualByNavigator( $nav1, $nav2 )
	{
		/**
		 * @var XPathNodeIterator $ni1
		 * @var XPathNodeIterator $ni2
		 */
		$ni1 = ElementOrderNodeIterator::fromNavigator( $this->context, $nav1 );
		$ni2 = ElementOrderNodeIterator::fromNavigator( $this->context, $nav2 );

		$count1 = $ni1->getCount();
		$count2 = $ni2->getCount();

		if ( $count1 != $count2 ) return false;

		if ( $count1 )
		{
			return $this->DeepEqualByIterator( $ni1, $ni2 );
		}
		else
		{
			$doni1 = ChildNodeIterator::fromNodeTest( $this->context, null, XPath2NodeIterator::Create( $nav1 ) );
			$doni2 = ChildNodeIterator::fromNodeTest( $this->context, null, XPath2NodeIterator::Create( $nav2 ) );

			return $this->DeepEqualByIterator( $doni1, $doni2 );

			return $this->NodeEqual( $nav1, $nav2 );
		}
	}
190779
private function compare(PackedItem $itemA, PackedItem $itemB): int
    {
        $itemAVolume = $itemA->getItem()->getWidth() * $itemA->getItem()->getLength() * $itemA->getItem()->getDepth();
        $itemBVolume = $itemB->getItem()->getWidth() * $itemB->getItem()->getLength() * $itemB->getItem()->getDepth();

        return ($itemBVolume <=> $itemAVolume) ?: ($itemB->getItem()->getWeight() <=> $itemA->getItem()->getWeight());
    }
160791
public function previous()
    {
        $this->_itemValid = true;

        if (!prev($this->_items)) {
            $this->_itemValid = false;
        } else {
            $this->_itemPosition--;
        }
    }
735498
public function removeItem(Item $item)
    {
        if ($this->items->contains($item)) {
            $this->items->removeElement($item);
            $item->removeGenre($this);
        }

        return $this;
    }
144004
public static function compare($value1, $value2)
    {
        if (self::isIntlLoaded()) {
            return self::getCollator()->compare($value1, $value2);
        }
        
        return strnatcmp($value1, $value2);
    }
898145
public function hasItemChild($itemName,$childName)
	{
		return $this->db->createCommand()
			->select('parent')
			->from($this->itemChildTable)
			->where('parent=:parent AND child=:child', array(
				':parent'=>$itemName,
				':child'=>$childName))
			->queryScalar() !== false;
	}
222512
private function sort($items, $order)
    {
        uasort($items, function (Item $item1, Item $item2) use ($order) {
            return ($item1->getValue() < $item2->getValue()) ? (-1 * $order) : $order;
        });

        return $items;
    }
563744
private function findItemIn($item, $key)
	{
		$array = $this->find($key);
		if($array) return $this->array_get($array, $item);
		return false;
	}