XBRL-Instance.php
private function validateMeasure( $measure, $unitId, $types, $forceCurrencyCheck = false )
	{
		if ( empty( $measure ) )
		{
			$this->log()->instance_validation( "4.8.2", "The measure cannot be empty", array( 'unit' => $unitId ) );
			return false;
		}

		// The measure must have a value that is a qname with a prefix in scope or a value with a namespace provided as an attribute.
		$qName = qname( $measure, $this->instance_namespaces + array( STANDARD_PREFIX_XBRLI => XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_XBRLI ] ) );

		if ( ! $qName )
		{
			$this->log()->instance_validation( "4.8.2", "The measure value is not valid",
				array(
					'unit' => $unitId,
					'measure' => $measure,
				)
			);
			return false;
		}

		if ( $qName->namespaceURI == XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_ISO4217 ] )
		{
			// The local name value MUST be a valid ISO country code.  A minimum is that it should be three characters.
			if ( strlen( $qName->localName ) == 3 ) return true;
			$this->log()->instance_validation( "4.8.2", "The measure value is not a valid ISO country code",
				array(
					'unit' => $unitId,
					'measure' => $measure,
				)
			);
			return false;
		}
		if ( $forceCurrencyCheck )
		{
			$this->log()->instance_validation( "4.8.2", "The measure value for monetary facts must be a valid ISO country code",
				array(
					'unit' => $unitId,
					'measure' => $measure,
				)
			);
			return false;
		}

		// BMS 2018-04-18 This test is not quite right because it's the local name that MUST be pure or shares if the namespace resolves to xbrli
		//				  From 4.8.2:	A <measure> element with a namespace prefix that resolves to the
		//								"http://www.xbrl.org/2003/instance" namespace MUST have a local
		//								part of either "pure" or "shares".
		// if ( $qName->localName == 'pure' && ! isset( $this->instance_namespaces[ $qName->prefix ] ) )
		// if ( $qName->localName == 'pure' && $qName->prefix == STANDARD_PREFIX_XBRLI )
		// {
		// 	if ( $qName->namespaceURI == XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_XBRLI ] ) return true;
		// 	$this->log()->instance_validation( "4.8.2", "The xbrli:pure measure must have a namespace of http://www.xbrl.org/2003/instance",
		// 		array(
		// 			'unit' => $unitId,
		// 			'measure' => $measure,
		// 		)
		// 	);
		// 	return false;
		// }
        //
		// if ( $qName->localName == 'shares' )
		// {
		// 	if ( $qName->namespaceURI == XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_XBRLI ] ) return true;
		// 	$this->log()->instance_validation( "4.8.2", "The shares measure must have a namespace of http://www.xbrl.org/2003/instance",
		// 		array(
		// 			'unit' => $unitId,
		// 			'measure' => $measure,
		// 		)
		// 	);
		// 	return false;
		// }

		if ( $qName->namespaceURI == XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_XBRLI ] )
		{
			if ( ! in_array( $qName->localName, array( 'pure', 'shares' ) ) )
			{
				$this->log()->instance_validation( "4.8.2", "A measure with a namespace of http://www.xbrl.org/2003/instance MUST be 'pure' or 'shares'",
					array(
						'unit' => $unitId,
						'measure' => $measure,
					)
				);

				return false;
			}
		}

		// Otherwise the namespace must be in scope
		return true;
	}
private function validateMeasure( $measure, $unitId, $types, $forceCurrencyCheck = false )
	{
		if ( empty( $measure ) )
		{
			$this->log()->instance_validation( "4.8.2", "The measure cannot be empty", array( 'unit' => $unitId ) );
			return false;
		}

		// The measure must have a value that is a qname with a prefix in scope or a value with a namespace provided as an attribute.
		$qName = qname( $measure, $this->instance_namespaces + array( STANDARD_PREFIX_XBRLI => XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_XBRLI ] ) );

		if ( ! $qName )
		{
			$this->log()->instance_validation( "4.8.2", "The measure value is not valid",
				array(
					'unit' => $unitId,
					'measure' => $measure,
				)
			);
			return false;
		}

		if ( $qName->namespaceURI == XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_ISO4217 ] )
		{
			// The local name value MUST be a valid ISO country code.  A minimum is that it should be three characters.
			if ( strlen( $qName->localName ) == 3 ) return true;
			$this->log()->instance_validation( "4.8.2", "The measure value is not a valid ISO country code",
				array(
					'unit' => $unitId,
					'measure' => $measure,
				)
			);
			return false;
		}
		if ( $forceCurrencyCheck )
		{
			$this->log()->instance_validation( "4.8.2", "The measure value for monetary facts must be a valid ISO country code",
				array(
					'unit' => $unitId,
					'measure' => $measure,
				)
			);
			return false;
		}

		// BMS 2018-04-18 This test is not quite right because it's the local name that MUST be pure or shares if the namespace resolves to xbrli
		//				  From 4.8.2:	A <measure> element with a namespace prefix that resolves to the
		//								"http://www.xbrl.org/2003/instance" namespace MUST have a local
		//								part of either "pure" or "shares".
		// if ( $qName->localName == 'pure' && ! isset( $this->instance_namespaces[ $qName->prefix ] ) )
		// if ( $qName->localName == 'pure' && $qName->prefix == STANDARD_PREFIX_XBRLI )
		// {
		// 	if ( $qName->namespaceURI == XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_XBRLI ] ) return true;
		// 	$this->log()->instance_validation( "4.8.2", "The xbrli:pure measure must have a namespace of http://www.xbrl.org/2003/instance",
		// 		array(
		// 			'unit' => $unitId,
		// 			'measure' => $measure,
		// 		)
		// 	);
		// 	return false;
		// }
        //
		// if ( $qName->localName == 'shares' )
		// {
		// 	if ( $qName->namespaceURI == XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_XBRLI ] ) return true;
		// 	$this->log()->instance_validation( "4.8.2", "The shares measure must have a namespace of http://www.xbrl.org/2003/instance",
		// 		array(
		// 			'unit' => $unitId,
		// 			'measure' => $measure,
		// 		)
		// 	);
		// 	return false;
		// }

		if ( $qName->namespaceURI == XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_XBRLI ] )
		{
			if ( ! in_array( $qName->localName, array( 'pure', 'shares' ) ) )
			{
				$this->log()->instance_validation( "4.8.2", "A measure with a namespace of http://www.xbrl.org/2003/instance MUST be 'pure' or 'shares'",
					array(
						'unit' => $unitId,
						'measure' => $measure,
					)
				);

				return false;
			}
		}

		// Otherwise the namespace must be in scope
		return true;
	}
private function validateMeasure ( $ measure , $ unitId , $ types , $ forceCurrencyCheck = false ) { if ( empty ( $ measure ) ) { $ this -> log ( ) -> instance_validation ( "4.8.2" , "The measure cannot be empty" , array ( 'unit' => $ unitId ) ) ; return false ; } // The measure must have a value that is a qname with a prefix in scope or a value with a namespace provided as an attribute.
 $ qName = qname ( $ measure , $ this -> instance_namespaces + array ( STANDARD_PREFIX_XBRLI => XBRL_Constants :: $ standardPrefixes [ STANDARD_PREFIX_XBRLI ] ) ) ; if ( ! $ qName ) { $ this -> log ( ) -> instance_validation ( "4.8.2" , "The measure value is not valid" , array ( 'unit' => $ unitId , 'measure' => $ measure , ) ) ; return false ; } if ( $ qName -> namespaceURI == XBRL_Constants :: $ standardPrefixes [ STANDARD_PREFIX_ISO4217 ] ) { // The local name value MUST be a valid ISO country code.  A minimum is that it should be three characters.
 if ( strlen ( $ qName -> localName ) == 3 ) return true ; $ this -> log ( ) -> instance_validation ( "4.8.2" , "The measure value is not a valid ISO country code" , array ( 'unit' => $ unitId , 'measure' => $ measure , ) ) ; return false ; } if ( $ forceCurrencyCheck ) { $ this -> log ( ) -> instance_validation ( "4.8.2" , "The measure value for monetary facts must be a valid ISO country code" , array ( 'unit' => $ unitId , 'measure' => $ measure , ) ) ; return false ; } // BMS 2018-04-18 This test is not quite right because it's the local name that MUST be pure or shares if the namespace resolves to xbrli
 //				  From 4.8.2:	A <measure> element with a namespace prefix that resolves to the
 //								"http://www.xbrl.org/2003/instance" namespace MUST have a local
 //								part of either "pure" or "shares".
 // if ( $qName->localName == 'pure' && ! isset( $this->instance_namespaces[ $qName->prefix ] ) )
 // if ( $qName->localName == 'pure' && $qName->prefix == STANDARD_PREFIX_XBRLI )
 // {
 // 	if ( $qName->namespaceURI == XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_XBRLI ] ) return true;
 // 	$this->log()->instance_validation( "4.8.2", "The xbrli:pure measure must have a namespace of http://www.xbrl.org/2003/instance",
 // 		array(
 // 			'unit' => $unitId,
 // 			'measure' => $measure,
 // 		)
 // 	);
 // 	return false;
 // }
 //
 // if ( $qName->localName == 'shares' )
 // {
 // 	if ( $qName->namespaceURI == XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_XBRLI ] ) return true;
 // 	$this->log()->instance_validation( "4.8.2", "The shares measure must have a namespace of http://www.xbrl.org/2003/instance",
 // 		array(
 // 			'unit' => $unitId,
 // 			'measure' => $measure,
 // 		)
 // 	);
 // 	return false;
 // }
 if ( $ qName -> namespaceURI == XBRL_Constants :: $ standardPrefixes [ STANDARD_PREFIX_XBRLI ] ) { if ( ! in_array ( $ qName -> localName , array ( 'pure' , 'shares' ) ) ) { $ this -> log ( ) -> instance_validation ( "4.8.2" , "A measure with a namespace of http://www.xbrl.org/2003/instance MUST be 'pure' or 'shares'" , array ( 'unit' => $ unitId , 'measure' => $ measure , ) ) ; return false ; } } // Otherwise the namespace must be in scope
 return true ; }
Validates the divide component of a unit definition

@param string $measure
@param string $unitId
@param XBRL_Types $types
@param bool $forceCurrencyCheck

@return bool Return false if there has been any validation issue
Validates the divide component of a unit definition