XBRL-Instance.php
public static function FromInstanceCache( $cache_path, $cache_basename, $taxonomyNamespace, $compiledTaxonomyFile )
	{
		$xbrl = XBRL::load_taxonomy( $compiledTaxonomyFile );
		if ( ! $xbrl ) return false;

		$json = null;

		if ( XBRL::endsWith( $cache_basename, '.zip' ) )
		{
			$zip = new \ZipArchive();
			$zip->open( "$cache_path/$cache_basename" );
			$json = $zip->getFromName( basename( $cache_basename, '.zip' ) . '.json' );
		}
		else
		{
			$json = file_get_contents( "$cache_path/$cache_basename" );
		}

		$instance = new XBRL_Instance();

		$array = json_decode( $json, true );

		$instance->allowNested = $array['allowNested'];
		$instance->contextDimensionMemberList = $array['contextDimensionMemberList'];
		$instance->contexts = $array['contexts'];
		$instance->document_name = $array['document_name'];
		$instance->duplicateFacts = TupleDictionary::fromJSON( $array['duplicateFacts'] );
		$instance->elements = $array['elements'];
		$instance->error = $array['error'];
		$instance->footnotes = $array['footnotes'];
		$instance->guid = $array['guid'];
		$instance->instance_namespaces = $array['instance_namespaces'];
		$instance->segments = $array['segments'];
		$instance->tupleRefs = $array['tupleRefs'];
		$instance->uniqueFactIds = $array['uniqueFactIds'];
		$instance->units = $array['units'];
		$instance->usedContexts = $array['usedContexts'];
		$instance->instance_xml = simplexml_load_file( $instance->document_name );

		$taxonomy = $xbrl->getTaxonomyForNamespace( $taxonomyNamespace );
		XBRL_Instance::$instance_taxonomy[ $taxonomy->getSchemaLocation() ] = $taxonomy;
		$instance->schemaFilename = $taxonomy->getSchemaLocation();
		$instance->defaultCurrency = $taxonomy->getDefaultCurrency();
		$instance->taxonomyToNamespaceMap = $taxonomy->getImportedSchemas();

		return $instance;
	}
public static function FromInstanceCache( $cache_path, $cache_basename, $taxonomyNamespace, $compiledTaxonomyFile )
	{
		$xbrl = XBRL::load_taxonomy( $compiledTaxonomyFile );
		if ( ! $xbrl ) return false;

		$json = null;

		if ( XBRL::endsWith( $cache_basename, '.zip' ) )
		{
			$zip = new \ZipArchive();
			$zip->open( "$cache_path/$cache_basename" );
			$json = $zip->getFromName( basename( $cache_basename, '.zip' ) . '.json' );
		}
		else
		{
			$json = file_get_contents( "$cache_path/$cache_basename" );
		}

		$instance = new XBRL_Instance();

		$array = json_decode( $json, true );

		$instance->allowNested = $array['allowNested'];
		$instance->contextDimensionMemberList = $array['contextDimensionMemberList'];
		$instance->contexts = $array['contexts'];
		$instance->document_name = $array['document_name'];
		$instance->duplicateFacts = TupleDictionary::fromJSON( $array['duplicateFacts'] );
		$instance->elements = $array['elements'];
		$instance->error = $array['error'];
		$instance->footnotes = $array['footnotes'];
		$instance->guid = $array['guid'];
		$instance->instance_namespaces = $array['instance_namespaces'];
		$instance->segments = $array['segments'];
		$instance->tupleRefs = $array['tupleRefs'];
		$instance->uniqueFactIds = $array['uniqueFactIds'];
		$instance->units = $array['units'];
		$instance->usedContexts = $array['usedContexts'];
		$instance->instance_xml = simplexml_load_file( $instance->document_name );

		$taxonomy = $xbrl->getTaxonomyForNamespace( $taxonomyNamespace );
		XBRL_Instance::$instance_taxonomy[ $taxonomy->getSchemaLocation() ] = $taxonomy;
		$instance->schemaFilename = $taxonomy->getSchemaLocation();
		$instance->defaultCurrency = $taxonomy->getDefaultCurrency();
		$instance->taxonomyToNamespaceMap = $taxonomy->getImportedSchemas();

		return $instance;
	}
public static function FromInstanceCache ( $ cache_path , $ cache_basename , $ taxonomyNamespace , $ compiledTaxonomyFile ) { $ xbrl = XBRL :: load_taxonomy ( $ compiledTaxonomyFile ) ; if ( ! $ xbrl ) return false ; $ json = null ; if ( XBRL :: endsWith ( $ cache_basename , '.zip' ) ) { $ zip = new \ ZipArchive ( ) ; $ zip -> open ( "$cache_path/$cache_basename" ) ; $ json = $ zip -> getFromName ( basename ( $ cache_basename , '.zip' ) . '.json' ) ; } else { $ json = file_get_contents ( "$cache_path/$cache_basename" ) ; } $ instance = new XBRL_Instance ( ) ; $ array = json_decode ( $ json , true ) ; $ instance -> allowNested = $ array [ 'allowNested' ] ; $ instance -> contextDimensionMemberList = $ array [ 'contextDimensionMemberList' ] ; $ instance -> contexts = $ array [ 'contexts' ] ; $ instance -> document_name = $ array [ 'document_name' ] ; $ instance -> duplicateFacts = TupleDictionary :: fromJSON ( $ array [ 'duplicateFacts' ] ) ; $ instance -> elements = $ array [ 'elements' ] ; $ instance -> error = $ array [ 'error' ] ; $ instance -> footnotes = $ array [ 'footnotes' ] ; $ instance -> guid = $ array [ 'guid' ] ; $ instance -> instance_namespaces = $ array [ 'instance_namespaces' ] ; $ instance -> segments = $ array [ 'segments' ] ; $ instance -> tupleRefs = $ array [ 'tupleRefs' ] ; $ instance -> uniqueFactIds = $ array [ 'uniqueFactIds' ] ; $ instance -> units = $ array [ 'units' ] ; $ instance -> usedContexts = $ array [ 'usedContexts' ] ; $ instance -> instance_xml = simplexml_load_file ( $ instance -> document_name ) ; $ taxonomy = $ xbrl -> getTaxonomyForNamespace ( $ taxonomyNamespace ) ; XBRL_Instance :: $ instance_taxonomy [ $ taxonomy -> getSchemaLocation ( ) ] = $ taxonomy ; $ instance -> schemaFilename = $ taxonomy -> getSchemaLocation ( ) ; $ instance -> defaultCurrency = $ taxonomy -> getDefaultCurrency ( ) ; $ instance -> taxonomyToNamespaceMap = $ taxonomy -> getImportedSchemas ( ) ; return $ instance ; }
Creates an instance object from a JSON string, perhaps in a zip file
@param string $cache_path
@param string $cache_basename
@param string $taxonomyNamespace
@param string $compiledTaxonomyFile
@return XBRL_Instance
Creates an instance object from a JSON string perhaps in a zip file