Formulas/ContextComparer.php
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 );
	}
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 );
	}
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 ) ; }
Test if two items are equal
Overridden so dates can be compared taking into account there relationship with the period end
@param XPathItem $item1
@param XPathItem $item2
@return bool
Test if two items are equal Overridden so dates can be compared taking into account there relationship with the period end