Test if two items are equal
@param XPathItem $item1
@param XPathItem $item2
@return bool
510934
protected function ItemEqual( $item1, $item2 )
	{
		$xTypeCode = $item1->getSchemaType()->TypeCode;
		$yTypeCode = $item2->getSchemaType()->TypeCode;
		$types = array( XmlTypeCode::Decimal, XmlTypeCode::Float, XmlTypeCode::Double, XmlTypeCode::Integer );

		$x = $item1->GetTypedValue();
		// BMS 2018-01-19	Could be numeric
		//					Added to support typed member comparisons in FactVariables
		if ( $this->untypedCanBeNumeric && $x instanceof UntypedAtomic )
		{
			if ( is_numeric( $x->getValue() ) )
			{
				$x = floatval( $x->getValue() );
			}
		}
		if ( $x instanceof UntypedAtomic || $x instanceof AnyUriValue )
		{
			// Special case
			// If $x is AnyUriValue or the attribute name is 'scheme' then
			// normalize by making sure the scheme starts with a scheme
			// such as http:// https:// ftp:// etc
			$special = /* $x instanceof AnyUriValue || */ ( $item1 instanceof XPathNavigator && $item1->getLocalName() == 'scheme' );
			$x = $x->ToString();
			$xTypeCode = XmlTypeCode::String;

			if ( $special && strpos( $x, "://" ) === false )
			{
				$x = "http://" . $x;
			}
		}

		$y = $item2->GetTypedValue();
		// BMS 2018-01-19	Could be numeric
		//					Added to support typed member comparisons in FactVariables
		if ( $this->untypedCanBeNumeric && $y instanceof UntypedAtomic )
		{
			if ( is_numeric( $y->getValue() ) )
			{
				$y = floatval( $y->getValue() );
			}
		}
		if ( $y instanceof UntypedAtomic || $y instanceof AnyUriValue )
		{
			// Special case
			// If $y is AnyUriValue or the attribute name is 'scheme' then
			// normalize by making sure the scheme starts with a scheme
			// such as http:// https:// ftp:// etc
			$special = /* $y instanceof AnyUriValue || */( $item2 instanceof XPathNavigator && $item2->getLocalName() == 'scheme' );
			$y = $y->ToString();
			$yTypeCode = XmlTypeCode::String;

			if ( $special && strpos( $y, "://" ) === false )
			{
				$y = "http://" . $y;
			}
		}

		if ( $this->useValueCompare )
		{
			if ( is_string( $x ) )
			{
				$x = trim( $x );
			}
		}

		if ( $this->useValueCompare )
		{
			if ( is_string( $y ) )
			{
				$y = trim( $y );
			}
		}

		if ( is_double( $x ) && is_nan( $x ) && is_double( $y ) && is_nan( $y ) )
		{
			return true;
		}

		if ( is_double( $x ) && is_infinite( $x ) && is_double( $y ) && is_infinite( $y ) )
		{
			return true;
		}

		if ( $xTypeCode != $yTypeCode )
		{
			// Handle the exceptions
			$exceptions = (
				( $xTypeCode == XmlTypeCode::Integer && in_array( $yTypeCode, $types ) ) ||
			 	( $yTypeCode == XmlTypeCode::Integer && in_array( $xTypeCode, $types ) ) ||
				( $xTypeCode == XmlTypeCode::Decimal && in_array( $yTypeCode, $types ) ) ||
				( $yTypeCode == XmlTypeCode::Decimal && in_array( $xTypeCode, $types ) )
			);
			if ( ! $exceptions )
			{
				return false;
			}
		}

		if ( ! is_null( $this->collation ) && is_string( $x ) && is_string( $y ) )
		{
			if ( $this->collation == XmlReservedNs::collationCodepoint )
			{
				$x = \normalizer_normalize( $x, \Normalizer::FORM_C );
				$y = \normalizer_normalize( $y, \Normalizer::FORM_C );

				return strcmp( $x, $y );
			}
			else
			{
				return strcoll( $x, $y ) == 0;
			}
		}

		if ( ! is_object( $x ) && ! is_object( $y ) )
		{
			if ( $x == $y )
			{
				return true;
			}
		}
		else if ( is_object( $x ) && is_object( $y ) && method_exists( $x, "Equals" ) && method_exists( $y, "Equals" ) )
		{
			if ( $x->Equals( $y ) )
			{
				return true;
			}
		}

		$res;
		$result = ValueProxy::EqValues( $x, $y, $res) && $res;
		return $result;

	}
19085
private static int compare(Treenode item1, Treenode item2) {
        String label1 = item1.getLabel();
        String label2 = item2.getLabel();
        return label1 == label2 ? 0 : label1 == null ? -1 : label2 == null ? -1 : label1.compareToIgnoreCase(label2);
    }
1071489
public static function compare($hash1, $hash2): bool {
        if(!is_string($hash1)) {
            $hash1 = (string) $hash1;
        }
        if(!is_string($hash2)) {
            $hash2 = (string) $hash2;
        }
        return hash_equals($hash1, $hash2);
    }
883638
function contains($item, callable $callback = null) {
        if ($callback === null) {
            $callback = __NAMESPACE__ . '\\compare';
        }
        foreach ($this->avl as $pair) {
            /**
             * @var Pair $pair
             */
            if (call_user_func($callback, $pair->second, $item) === 0) {
                return true;
            }
        }

        return false;
    }
919194
public function checkItemIsActive($item)
    {
        if ($this->getActive()) {
            return true;
        }

        if (empty($item_list = $item->getHideIfItemNotActiveOption())) {
            return true;
        }

        if (!is_array($item_list)) {
            $item_list = [$item_list];
        }

        foreach ($item_list as $nickname) {
            $check_item = $item->getMenu()->get($nickname);

            if (!is_null($check_item) && $check_item->getActive()) {
                return true;
            }
        }

        return false;
    }
713707
public static function areEqual(&$ref1, &$ref2) : bool
    {
        if ($ref1 !== $ref2) {
            return false;
        }

        if (!self::$secret) {
            self::$secret = new \stdClass();
        }

        $tempStorage = $ref1;

        $ref1     = self::$secret;
        $areEqual = $ref1 === $ref2;

        $ref1 = $tempStorage;

        return $areEqual;
    }
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());
    }
181070
public function compare($object1, $object2)
    {
        if (! is_object($object1)) {
            throw new ComparatorException('$object1 ("' . $object1 . '") is not an object.');
        }
        if (! is_object($object2)) {
            throw new ComparatorException('$object2 ("' . $object2 . '") is not an object.');
        }
        return strcmp(spl_object_hash($object1), spl_object_hash($object2));
    }
227448
public static function is_same(string $file1, string $file2, $strict = false){
    if ( !is_file($file1) || !is_file($file2) ){
      throw Exception("Boo! One of the files given to the x::is_same function doesn't exist");
    }
    else{
      $same = filesize($file1) === filesize($file2);
      if ( !$strict || !$same ){
        return $same;
      }
      return filemtime($file1) === filemtime($file2);
    }
  }
1025923
public function contentEquals(PhingFile $file1, PhingFile $file2)
    {
        if (!($file1->exists() && $file2->exists())) {
            return false;
        }

        if (!($file1->canRead() && $file2->canRead())) {
            return false;
        }

        if ($file1->isDirectory() || $file2->isDirectory()) {
            return false;
        }

        $c1 = file_get_contents($file1->getAbsolutePath());
        $c2 = file_get_contents($file2->getAbsolutePath());

        return trim($c1) == trim($c2);
    }
364352
public static function compare_arrays_ordinal( $array1, $array2 )
	{
		if ( count( $array1 ) != count( $array2 ) ) return false;
		if ( ! count( $array1 ) ) return true;

		$types = XBRL_Types::getInstance();

		for( $i = 0; $i < count( $array1 ); $i++ )
		{
			$key1 = key( $array1 );
			$key2 = key( $array2 );

			if (  $key1 != $key2 ) return false;

			$value1 = current( $array1 );
			$value2 = current( $array2 );

			next( $array1 );
			next( $array2 );

			if ( $key1 == 'id' )
			{
				$pattern = "/^" . SchemaTypes::$ncName . "$/u";
				if ( ! preg_match( $pattern, $value1, $matches ) )
				{
					$this->log()->taxonomy_validation( "context", "id attribute is not a valid NCName", array( 'id' => $value1 ) );
				}
				if ( ! preg_match( $pattern, $value2, $matches ) )
				{
					$this->log()->taxonomy_validation( "context", "id attribute is not a valid NCName", array( 'id' => $value2 ) );
				}
			}

			if ( is_array( $value1 ) )
			{
				if ( ! is_array( $value2 ) ) return false;

				// These arrays will represent elements so compare the contents by name
				if ( ! XBRL_Equality::compare_arrays( $value1, $value2 ) )
				{
					return false;
				}
			}
			else if ( in_array( $key1, array( 'id', 'name', 'prefix', 'type' ) ) )
			{
				if ( $value1 != $value2 )
				{
					return false;
				}
			}
			else
			{
				$value1Type = XBRL_Equality::xEqualComparisonType( $value1, $types );
				$value2Type = XBRL_Equality::xEqualComparisonType( $value2, $types );
				if ( ! XBRL_Equality::xequal( $value1, $value2, $value1Type, $value2Type, $types ) )
				{
					return false;
				}
			}
		}

		return true;
	}
659796
public function isValidItemType(string $itemType): bool
    {
        if (!is_array($this->validItemTypes)) {
            return true;
        }

        return in_array($itemType, $this->validItemTypes, true);
    }
631535
private static boolean equal(int[] prod1, int[] prod2) {
        int ofs;

        if (prod1.length != prod2.length) {
            return false;
        }
        for (ofs = 0; ofs < prod1.length; ofs++) {
            if (prod1[ofs] != prod2[ofs]) {
                if (!((prod1[ofs] == prod1[0]) && (prod2[ofs] == prod2[0]))) {
                    return false;
                }
            }
        }
        return true;
    }
127872
protected function isSameDimensions(Item $itemA, Item $itemB): bool
    {
        $itemADimensions = [$itemA->getWidth(), $itemA->getLength(), $itemA->getDepth()];
        $itemBDimensions = [$itemB->getWidth(), $itemB->getLength(), $itemB->getDepth()];
        sort($itemADimensions);
        sort($itemBDimensions);

        return $itemADimensions === $itemBDimensions;
    }
757872
protected function isArticleParamsEqual($basketItem)
    {
        return ($basketItem->getProductId() == $this->getItemToValidate()->getArticleId() &&
                $basketItem->getPersParams() == $this->getItemToValidate()->getPersistParam() &&
                $basketItem->getSelList() == $this->getItemToValidate()->getSelectList());
    }
895714
protected function NodeEqual( $nav1, $nav2 )
	{
		if ( $nav1->getNodeType() != $nav2->getNodeType() )
		{
			return false;
		}

		switch ( $nav1->getNodeType() )
		{
			case XPathNodeType::Element:
				return $this->ElementEqual( $nav1, $nav2 );

			case XPathNodeType::Attribute:
				return $this->AttributeEqual( $nav1, $nav2 );

			case XPathNodeType::Text:
			case XPathNodeType::SignificantWhitespace:
			case XPathNodeType::Whitespace:
			case XPathNodeType::Comment:

				if ( $this->useValueCompare )
				{
					if ( $nav1->getValue() == $nav2->getValue() )
					{
						// return true;
					}
					$value = $nav1->getValue();
					$result = $this->ItemEqual( $nav1, $nav2);
					return $result;
				}
				else
				{
					return $this->TextEqual( $nav1->getValue(), $nav2->getValue() );
				}

			case XPathNodeType::ProcessingInstruction:
				return $this->ProcessingInstructionEqual( $nav1, $nav2 );

			default:
				return $this->DeepEqualByNavigator( $nav1, $nav2 );
		}
	}
1312353
public function compare( MShop_Order_Item_Base_Product_Interface $item )
	{
		if( $this->getFlags() === $item->getFlags()
			&& $this->getName() === $item->getName()
			&& $this->getProductCode() === $item->getProductCode()
			&& $this->getSupplierCode() === $item->getSupplierCode()
			&& $this->getPrice()->compare( $item->getPrice() ) === true
		) {
			return true;
		}

		return false;
	}