repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
recurly/recurly-client-php | lib/recurly/export_date_list.php | Recurly_ExportDateList.get | public static function get($params = null, $client = null) {
return new self(self::_uriWithParams('/export_dates', $params), $client);
} | php | public static function get($params = null, $client = null) {
return new self(self::_uriWithParams('/export_dates', $params), $client);
} | [
"public",
"static",
"function",
"get",
"(",
"$",
"params",
"=",
"null",
",",
"$",
"client",
"=",
"null",
")",
"{",
"return",
"new",
"self",
"(",
"self",
"::",
"_uriWithParams",
"(",
"'/export_dates'",
",",
"$",
"params",
")",
",",
"$",
"client",
")",
... | Fetch a list of dates that have exports.
@param array $params An array of parameters to include with the request
@param Recurly_Client $client Optional client for the request, useful for mocking the client
@return Recurly_ExportDateList | [
"Fetch",
"a",
"list",
"of",
"dates",
"that",
"have",
"exports",
"."
] | 28465f3caf50ee5bd03919534144640d06aba340 | https://github.com/recurly/recurly-client-php/blob/28465f3caf50ee5bd03919534144640d06aba340/lib/recurly/export_date_list.php#L11-L13 | train |
facile-it/doctrine-mysql-come-back | src/Connection.php | Connection.resetTransactionNestingLevel | private function resetTransactionNestingLevel()
{
if (! $this->selfReflectionNestingLevelProperty instanceof \ReflectionProperty) {
$reflection = new \ReflectionClass(DBALConnection::class);
// Private property has been renamed in DBAL 2.9.0+
if ($reflection->hasProperty('transactionNestingLevel')) {
$this->selfReflectionNestingLevelProperty = $reflection->getProperty('transactionNestingLevel');
} else {
$this->selfReflectionNestingLevelProperty = $reflection->getProperty('_transactionNestingLevel');
}
$this->selfReflectionNestingLevelProperty->setAccessible(true);
}
$this->selfReflectionNestingLevelProperty->setValue($this, 0);
} | php | private function resetTransactionNestingLevel()
{
if (! $this->selfReflectionNestingLevelProperty instanceof \ReflectionProperty) {
$reflection = new \ReflectionClass(DBALConnection::class);
// Private property has been renamed in DBAL 2.9.0+
if ($reflection->hasProperty('transactionNestingLevel')) {
$this->selfReflectionNestingLevelProperty = $reflection->getProperty('transactionNestingLevel');
} else {
$this->selfReflectionNestingLevelProperty = $reflection->getProperty('_transactionNestingLevel');
}
$this->selfReflectionNestingLevelProperty->setAccessible(true);
}
$this->selfReflectionNestingLevelProperty->setValue($this, 0);
} | [
"private",
"function",
"resetTransactionNestingLevel",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"selfReflectionNestingLevelProperty",
"instanceof",
"\\",
"ReflectionProperty",
")",
"{",
"$",
"reflection",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"DBALConne... | This is required because beginTransaction increment transactionNestingLevel
before the real query is executed, and results incremented also on gone away error.
This should be safe for a new established connection. | [
"This",
"is",
"required",
"because",
"beginTransaction",
"increment",
"transactionNestingLevel",
"before",
"the",
"real",
"query",
"is",
"executed",
"and",
"results",
"incremented",
"also",
"on",
"gone",
"away",
"error",
".",
"This",
"should",
"be",
"safe",
"for",... | c7249c6311ee3995938ac36ccf2d35672e6377d8 | https://github.com/facile-it/doctrine-mysql-come-back/blob/c7249c6311ee3995938ac36ccf2d35672e6377d8/src/Connection.php#L268-L284 | train |
bseddon/XBRL | XBRL.php | XBRL.setValidationState | public static function setValidationState( $state = true)
{
$previousState = XBRL::$validating;
XBRL::$validating = $state;
return $previousState;
} | php | public static function setValidationState( $state = true)
{
$previousState = XBRL::$validating;
XBRL::$validating = $state;
return $previousState;
} | [
"public",
"static",
"function",
"setValidationState",
"(",
"$",
"state",
"=",
"true",
")",
"{",
"$",
"previousState",
"=",
"XBRL",
"::",
"$",
"validating",
";",
"XBRL",
"::",
"$",
"validating",
"=",
"$",
"state",
";",
"return",
"$",
"previousState",
";",
... | Sets the flag indicating whether or not the taxonomy should be validated as it is loaded from a schema file
@param string $state
@return bool The previous state | [
"Sets",
"the",
"flag",
"indicating",
"whether",
"or",
"not",
"the",
"taxonomy",
"should",
"be",
"validated",
"as",
"it",
"is",
"loaded",
"from",
"a",
"schema",
"file"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L483-L488 | train |
bseddon/XBRL | XBRL.php | XBRL.add_entry_namespace_to_class_map_entries | public static function add_entry_namespace_to_class_map_entries( $map_entries, $classname )
{
if ( ! is_array( $map_entries ) || count( $map_entries ) === 0 ) return;
XBRL::$entrypoints_to_class_map = array_merge( XBRL::$entrypoints_to_class_map, array_fill_keys( $map_entries, $classname ) );
} | php | public static function add_entry_namespace_to_class_map_entries( $map_entries, $classname )
{
if ( ! is_array( $map_entries ) || count( $map_entries ) === 0 ) return;
XBRL::$entrypoints_to_class_map = array_merge( XBRL::$entrypoints_to_class_map, array_fill_keys( $map_entries, $classname ) );
} | [
"public",
"static",
"function",
"add_entry_namespace_to_class_map_entries",
"(",
"$",
"map_entries",
",",
"$",
"classname",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"map_entries",
")",
"||",
"count",
"(",
"$",
"map_entries",
")",
"===",
"0",
")",
"ret... | Called to allow a class file to register taxonomy entry point to class mapping
@param array $map_entries Array of maps
@param string $classname The name of the taxonomy class with which the $xsd_entries are associated
@return void | [
"Called",
"to",
"allow",
"a",
"class",
"file",
"to",
"register",
"taxonomy",
"entry",
"point",
"to",
"class",
"mapping"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L514-L519 | train |
bseddon/XBRL | XBRL.php | XBRL.compiled_taxonomy_for_xsd | public static function compiled_taxonomy_for_xsd( $xsd )
{
return isset( XBRL::$xsd_to_compiled_map[ $xsd ] ) ? XBRL::$xsd_to_compiled_map[ $xsd ] : null;
} | php | public static function compiled_taxonomy_for_xsd( $xsd )
{
return isset( XBRL::$xsd_to_compiled_map[ $xsd ] ) ? XBRL::$xsd_to_compiled_map[ $xsd ] : null;
} | [
"public",
"static",
"function",
"compiled_taxonomy_for_xsd",
"(",
"$",
"xsd",
")",
"{",
"return",
"isset",
"(",
"XBRL",
"::",
"$",
"xsd_to_compiled_map",
"[",
"$",
"xsd",
"]",
")",
"?",
"XBRL",
"::",
"$",
"xsd_to_compiled_map",
"[",
"$",
"xsd",
"]",
":",
... | This function returns the name of the compile taxonomy to use in place of the XSD
@param string $xsd The name of the XSD to be loaded
@return string The name of the corresponding compiled taxonomy | [
"This",
"function",
"returns",
"the",
"name",
"of",
"the",
"compile",
"taxonomy",
"to",
"use",
"in",
"place",
"of",
"the",
"XSD"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L562-L565 | train |
bseddon/XBRL | XBRL.php | XBRL.compileExtensionXSD | public static function compileExtensionXSD( $taxonomy_file, $className, $namespace = null, $output_basename = null, $compiledPath = null )
{
if ( ! filter_var( $taxonomy_file, FILTER_VALIDATE_URL ) ) $taxonomy_file = str_replace( '\\', '/', $taxonomy_file );
$taxonomy = XBRL::loadExtensionXSD( $taxonomy_file, $className, $namespace, $compiledPath );
if ( ! $taxonomy ) return false;
$namespace = $taxonomy->getNamespace();
// This is the folder in which the generated zip file will be saved.
$pathinfo = pathinfo( $taxonomy_file );
$output_path = is_null( $compiledPath )
? ( isset( $pathinfo['dirname'] ) ? $pathinfo['dirname'] : "." )
: $compiledPath;
// Get the basename from the taxonomy if one is not supplied but if one is, make sure only the basename is used even if a full path has been specified.
$output_basename = $output_basename === null ? $pathinfo['filename'] : basename( $output_basename );
// Now remove the existng labels, arcs and locators so the saved file only contains the extension components
if ( ! isset( $taxonomy->labels[ XBRL_Constants::$defaultLinkRole ] ) )
{
XBRL_Log::getInstance()->err( "There are no labels in the extension taxonomy" );
return false;
}
// Grab the extension taxonomy labels
// Normally the labels are held within the context but when an extension
// taxonomy is being processed, a copy of the extension taxonomy labels
// is held in the XBRL instance prepresenting the extension taxonomy.
// See the end of the processLabelLinkbase() function in class XBRL.
$labels =& $taxonomy->labels[ XBRL_Constants::$defaultLinkRole ];
// Put them into the context
$taxonomy->context->labels[ XBRL_Constants::$defaultLinkRole ] = $labels;
// Delete the other schemas
// $taxonomy->context->importedSchemas = array( $namespace => $taxonomy );
$taxonomy->context->importedSchemas = array_diff_key( $taxonomy->context->importedSchemas, $taxonomy->previouslyImportedSchemas );
// Create and save the JSON
$json = $taxonomy->toJSON( $taxonomy->baseTaxonomy );
file_put_contents( "$output_path/$output_basename.json", $json );
$zip = new ZipArchive();
$zip->open( "$output_path/$output_basename.zip", ZipArchive::CREATE | ZipArchive::OVERWRITE );
$zip->addFile( "$output_path/$output_basename.json", "$output_basename.json" );
if ( $zip->close() === false )
{
XBRL_Log::getInstance()->err( "Error closing zip file" );
XBRL_Log::getInstance()->err( $zip->getStatusString() );
}
return $taxonomy;
} | php | public static function compileExtensionXSD( $taxonomy_file, $className, $namespace = null, $output_basename = null, $compiledPath = null )
{
if ( ! filter_var( $taxonomy_file, FILTER_VALIDATE_URL ) ) $taxonomy_file = str_replace( '\\', '/', $taxonomy_file );
$taxonomy = XBRL::loadExtensionXSD( $taxonomy_file, $className, $namespace, $compiledPath );
if ( ! $taxonomy ) return false;
$namespace = $taxonomy->getNamespace();
// This is the folder in which the generated zip file will be saved.
$pathinfo = pathinfo( $taxonomy_file );
$output_path = is_null( $compiledPath )
? ( isset( $pathinfo['dirname'] ) ? $pathinfo['dirname'] : "." )
: $compiledPath;
// Get the basename from the taxonomy if one is not supplied but if one is, make sure only the basename is used even if a full path has been specified.
$output_basename = $output_basename === null ? $pathinfo['filename'] : basename( $output_basename );
// Now remove the existng labels, arcs and locators so the saved file only contains the extension components
if ( ! isset( $taxonomy->labels[ XBRL_Constants::$defaultLinkRole ] ) )
{
XBRL_Log::getInstance()->err( "There are no labels in the extension taxonomy" );
return false;
}
// Grab the extension taxonomy labels
// Normally the labels are held within the context but when an extension
// taxonomy is being processed, a copy of the extension taxonomy labels
// is held in the XBRL instance prepresenting the extension taxonomy.
// See the end of the processLabelLinkbase() function in class XBRL.
$labels =& $taxonomy->labels[ XBRL_Constants::$defaultLinkRole ];
// Put them into the context
$taxonomy->context->labels[ XBRL_Constants::$defaultLinkRole ] = $labels;
// Delete the other schemas
// $taxonomy->context->importedSchemas = array( $namespace => $taxonomy );
$taxonomy->context->importedSchemas = array_diff_key( $taxonomy->context->importedSchemas, $taxonomy->previouslyImportedSchemas );
// Create and save the JSON
$json = $taxonomy->toJSON( $taxonomy->baseTaxonomy );
file_put_contents( "$output_path/$output_basename.json", $json );
$zip = new ZipArchive();
$zip->open( "$output_path/$output_basename.zip", ZipArchive::CREATE | ZipArchive::OVERWRITE );
$zip->addFile( "$output_path/$output_basename.json", "$output_basename.json" );
if ( $zip->close() === false )
{
XBRL_Log::getInstance()->err( "Error closing zip file" );
XBRL_Log::getInstance()->err( $zip->getStatusString() );
}
return $taxonomy;
} | [
"public",
"static",
"function",
"compileExtensionXSD",
"(",
"$",
"taxonomy_file",
",",
"$",
"className",
",",
"$",
"namespace",
"=",
"null",
",",
"$",
"output_basename",
"=",
"null",
",",
"$",
"compiledPath",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"filter_... | This is a complementary one for SEC extension taxonomies. It first loads the US_GAAP_2015
compiled taxonomy then adds the extension taxonomy given as parameter one
Compiles a taxonomy into an a collection of arrays then convert to JSON and save to a file.
@param string $taxonomy_file The name of the taxonomy file (xsd) to load
@param string $className The name of the XBRL taxonomy class to load
@param string $namespace The namespace of the extension taxonomy.
@param string $output_basename A name to use as the base for output files. 'xxx' will result in 'xxx.zip' and 'xxx.json' output files. If a name is not supplied, the basename of the schema file will be used.
@param string $compiledPath
@return boolean|XBRL <false, XBRL> | [
"This",
"is",
"a",
"complementary",
"one",
"for",
"SEC",
"extension",
"taxonomies",
".",
"It",
"first",
"loads",
"the",
"US_GAAP_2015",
"compiled",
"taxonomy",
"then",
"adds",
"the",
"extension",
"taxonomy",
"given",
"as",
"parameter",
"one"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L1157-L1211 | train |
bseddon/XBRL | XBRL.php | XBRL.isCompiled | public static function isCompiled( $compiledDir, $basename )
{
$extensions = array( 'json', 'zip' );
// Make sure the dir ends in /
$compiledDir = rtrim( $compiledDir, '/' ) . "/";
foreach ( $extensions as $extension )
{
$compiledFile = "$compiledDir$basename.$extension";
if ( ! file_exists( $compiledFile ) ) continue;
return $compiledFile;
}
return false;
} | php | public static function isCompiled( $compiledDir, $basename )
{
$extensions = array( 'json', 'zip' );
// Make sure the dir ends in /
$compiledDir = rtrim( $compiledDir, '/' ) . "/";
foreach ( $extensions as $extension )
{
$compiledFile = "$compiledDir$basename.$extension";
if ( ! file_exists( $compiledFile ) ) continue;
return $compiledFile;
}
return false;
} | [
"public",
"static",
"function",
"isCompiled",
"(",
"$",
"compiledDir",
",",
"$",
"basename",
")",
"{",
"$",
"extensions",
"=",
"array",
"(",
"'json'",
",",
"'zip'",
")",
";",
"// Make sure the dir ends in /\r",
"$",
"compiledDir",
"=",
"rtrim",
"(",
"$",
"co... | See if there are compiled files for the base name
@param string $compiledDir
@param string $basename
@return false|string | [
"See",
"if",
"there",
"are",
"compiled",
"files",
"for",
"the",
"base",
"name"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L1552-L1566 | train |
bseddon/XBRL | XBRL.php | XBRL.compile | public static function compile( $taxonomy_file, $namespace = null, $output_basename = null )
{
$xbrl = XBRL::load_taxonomy( $taxonomy_file, true );
if ( $xbrl === false )
{
XBRL_Log::getInstance()->err( "Taxonomy failed to load" );
return false;
}
$taxonomy = $namespace === null ? $xbrl : $xbrl->getTaxonomyForNamespace( $namespace );
$xbrl->saveTaxonomy( $namespace, $output_basename );
return $taxonomy;
} | php | public static function compile( $taxonomy_file, $namespace = null, $output_basename = null )
{
$xbrl = XBRL::load_taxonomy( $taxonomy_file, true );
if ( $xbrl === false )
{
XBRL_Log::getInstance()->err( "Taxonomy failed to load" );
return false;
}
$taxonomy = $namespace === null ? $xbrl : $xbrl->getTaxonomyForNamespace( $namespace );
$xbrl->saveTaxonomy( $namespace, $output_basename );
return $taxonomy;
} | [
"public",
"static",
"function",
"compile",
"(",
"$",
"taxonomy_file",
",",
"$",
"namespace",
"=",
"null",
",",
"$",
"output_basename",
"=",
"null",
")",
"{",
"$",
"xbrl",
"=",
"XBRL",
"::",
"load_taxonomy",
"(",
"$",
"taxonomy_file",
",",
"true",
")",
";... | Compile a taxonomy into an a collection of arrays then convert to JSON and save to a file.
@param string $taxonomy_file The name of the taxonomy file (xsd) to load
@param string $namespace The namespace of the taxonomy imported by the one being loaded that is to be returned.
@param string $output_basename A name to use as the base for output files. 'xxx' will result in 'xxx.zip' and 'xxx.json' output files
@return false|XBRL <false, XBRL> | [
"Compile",
"a",
"taxonomy",
"into",
"an",
"a",
"collection",
"of",
"arrays",
"then",
"convert",
"to",
"JSON",
"and",
"save",
"to",
"a",
"file",
"."
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L1576-L1590 | train |
bseddon/XBRL | XBRL.php | XBRL.isTuple | public static function isTuple( $taxonomy_element, $types = null )
{
if ( $types == null ) $types = XBRL_Types::getInstance();
return isset( $taxonomy_element['substitutionGroup'] ) &&
$types->resolveToSubstitutionGroup( $taxonomy_element['substitutionGroup'], array( XBRL_Constants::$xbrliTuple ) );
} | php | public static function isTuple( $taxonomy_element, $types = null )
{
if ( $types == null ) $types = XBRL_Types::getInstance();
return isset( $taxonomy_element['substitutionGroup'] ) &&
$types->resolveToSubstitutionGroup( $taxonomy_element['substitutionGroup'], array( XBRL_Constants::$xbrliTuple ) );
} | [
"public",
"static",
"function",
"isTuple",
"(",
"$",
"taxonomy_element",
",",
"$",
"types",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"types",
"==",
"null",
")",
"$",
"types",
"=",
"XBRL_Types",
"::",
"getInstance",
"(",
")",
";",
"return",
"isset",
"(",
... | Tests whether the node represents a tuple
@param array $taxonomy_element An XBRL element node
@param XBRL_Types $types (optional) an instance of the XBRL_types class
@return boolean True|False | [
"Tests",
"whether",
"the",
"node",
"represents",
"a",
"tuple"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L1639-L1645 | train |
bseddon/XBRL | XBRL.php | XBRL.removeNumberValueFormatting | public function removeNumberValueFormatting( $element )
{
if ( empty( $element['value'] ) ) $element['value'];
if ( is_null( $this->numberFormatter ) )
{
$this->numberFormatter = new NumberFormatter( $this->getLocale(), NumberFormatter::DECIMAL );
}
return $this->numberFormatter->parse( $element['value'], NumberFormatter::TYPE_DOUBLE );
} | php | public function removeNumberValueFormatting( $element )
{
if ( empty( $element['value'] ) ) $element['value'];
if ( is_null( $this->numberFormatter ) )
{
$this->numberFormatter = new NumberFormatter( $this->getLocale(), NumberFormatter::DECIMAL );
}
return $this->numberFormatter->parse( $element['value'], NumberFormatter::TYPE_DOUBLE );
} | [
"public",
"function",
"removeNumberValueFormatting",
"(",
"$",
"element",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"element",
"[",
"'value'",
"]",
")",
")",
"$",
"element",
"[",
"'value'",
"]",
";",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"numberF... | Return the value of the element after removing any formatting.
This base implementation will return the naked value. It is expected
descendants will provide specific implementations.
@param array $element
@return float | [
"Return",
"the",
"value",
"of",
"the",
"element",
"after",
"removing",
"any",
"formatting",
".",
"This",
"base",
"implementation",
"will",
"return",
"the",
"naked",
"value",
".",
"It",
"is",
"expected",
"descendants",
"will",
"provide",
"specific",
"implementati... | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L1881-L1891 | train |
bseddon/XBRL | XBRL.php | XBRL.getLinkbase | public function getLinkbase( $linkbaseName )
{
return isset( $this->linkbases[ basename( $linkbaseName ) ] )
? $this->linkbases[ basename( $linkbaseName ) ]
: null;
} | php | public function getLinkbase( $linkbaseName )
{
return isset( $this->linkbases[ basename( $linkbaseName ) ] )
? $this->linkbases[ basename( $linkbaseName ) ]
: null;
} | [
"public",
"function",
"getLinkbase",
"(",
"$",
"linkbaseName",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"linkbases",
"[",
"basename",
"(",
"$",
"linkbaseName",
")",
"]",
")",
"?",
"$",
"this",
"->",
"linkbases",
"[",
"basename",
"(",
"$",
"... | Return the details of a namespace if it exists or null
@param string $linkbaseName
@return NULL|array | [
"Return",
"the",
"details",
"of",
"a",
"namespace",
"if",
"it",
"exists",
"or",
"null"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L2003-L2008 | train |
bseddon/XBRL | XBRL.php | XBRL.getDocumentNamespaces | public function getDocumentNamespaces()
{
if ( ! $this->documentPrefixes )
{
if ( ! property_exists( $this, 'xbrlDocument' ) ) return null;
$this->documentPrefixes = $this->xbrlDocument->getDocNamespaces( true );
}
return $this->documentPrefixes;
} | php | public function getDocumentNamespaces()
{
if ( ! $this->documentPrefixes )
{
if ( ! property_exists( $this, 'xbrlDocument' ) ) return null;
$this->documentPrefixes = $this->xbrlDocument->getDocNamespaces( true );
}
return $this->documentPrefixes;
} | [
"public",
"function",
"getDocumentNamespaces",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"documentPrefixes",
")",
"{",
"if",
"(",
"!",
"property_exists",
"(",
"$",
"this",
",",
"'xbrlDocument'",
")",
")",
"return",
"null",
";",
"$",
"this",
"->",... | Allow a caller to access the namespaces in the taxonomy document
@return array | [
"Allow",
"a",
"caller",
"to",
"access",
"the",
"namespaces",
"in",
"the",
"taxonomy",
"document"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L2014-L2023 | train |
bseddon/XBRL | XBRL.php | XBRL.getDisplayRoundingFactor | public function getDisplayRoundingFactor( $decimal )
{
// Simple chcck
if ( ! is_numeric( $decimal ) || $decimal == 0 ) return 1;
// Note: using '==' so the array value is coerced to zero
if ( ! isset( $this->displayRoundings[ $decimal ] ) || $this->displayRoundings[ $decimal ] == 0 )
{
$this->setDisplayRoundingFactor( $decimal, abs( $decimal ) );
}
return $this->displayRoundings[ $decimal ];
} | php | public function getDisplayRoundingFactor( $decimal )
{
// Simple chcck
if ( ! is_numeric( $decimal ) || $decimal == 0 ) return 1;
// Note: using '==' so the array value is coerced to zero
if ( ! isset( $this->displayRoundings[ $decimal ] ) || $this->displayRoundings[ $decimal ] == 0 )
{
$this->setDisplayRoundingFactor( $decimal, abs( $decimal ) );
}
return $this->displayRoundings[ $decimal ];
} | [
"public",
"function",
"getDisplayRoundingFactor",
"(",
"$",
"decimal",
")",
"{",
"// Simple chcck\r",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"decimal",
")",
"||",
"$",
"decimal",
"==",
"0",
")",
"return",
"1",
";",
"// Note: using '==' so the array value is coerc... | Get the division factor for an @decimals value
@param int $decimal An index into the $displayRoundings array
@return int The division factor to use | [
"Get",
"the",
"division",
"factor",
"for",
"an"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L2101-L2113 | train |
bseddon/XBRL | XBRL.php | XBRL.getRoleTypes | public function getRoleTypes( $href = null )
{
if ( $href === null )
return $this->roleTypes;
else
{
$taxonomy = $this->getTaxonomyForXSD( $href );
return ( $taxonomy === false )
? false
: $taxonomy->getRoleTypes();
}
} | php | public function getRoleTypes( $href = null )
{
if ( $href === null )
return $this->roleTypes;
else
{
$taxonomy = $this->getTaxonomyForXSD( $href );
return ( $taxonomy === false )
? false
: $taxonomy->getRoleTypes();
}
} | [
"public",
"function",
"getRoleTypes",
"(",
"$",
"href",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"href",
"===",
"null",
")",
"return",
"$",
"this",
"->",
"roleTypes",
";",
"else",
"{",
"$",
"taxonomy",
"=",
"$",
"this",
"->",
"getTaxonomyForXSD",
"(",
... | Provide access to the roleTypes array
@param $href string|array The href is likely to come from a locator and can be the string or an array produced by parse_url.
@return An array of roleTypes corresponding to the taxonomy implied by the $href | [
"Provide",
"access",
"to",
"the",
"roleTypes",
"array"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L2262-L2273 | train |
bseddon/XBRL | XBRL.php | XBRL.getArcroleTypes | public function getArcroleTypes( $href = null )
{
if ( $href === null )
return $this->arcroleTypes;
else
{
$taxonomy = $this->getTaxonomyForXSD( $href );
return ( $taxonomy === false )
? false
: $taxonomy->getArcroleTypes();
}
} | php | public function getArcroleTypes( $href = null )
{
if ( $href === null )
return $this->arcroleTypes;
else
{
$taxonomy = $this->getTaxonomyForXSD( $href );
return ( $taxonomy === false )
? false
: $taxonomy->getArcroleTypes();
}
} | [
"public",
"function",
"getArcroleTypes",
"(",
"$",
"href",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"href",
"===",
"null",
")",
"return",
"$",
"this",
"->",
"arcroleTypes",
";",
"else",
"{",
"$",
"taxonomy",
"=",
"$",
"this",
"->",
"getTaxonomyForXSD",
"... | Provide access to the arcroleTypes array
@param $href string|array The href is likely to come from a locator and can be the string or an array produced by parse_url.
@return An array of arcroleTypes corresponding to the taxonomy implied by the $href | [
"Provide",
"access",
"to",
"the",
"arcroleTypes",
"array"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L2280-L2291 | train |
bseddon/XBRL | XBRL.php | XBRL.getPresentationRoleHypercubes | public function getPresentationRoleHypercubes( $roleKey )
{
/**
* @var array $refs
*/
$refs = $this->context->presentationRoleRefs;
if ( ! isset( $refs[ $roleKey ] ) ) return array();
return isset( $refs[ $roleKey ]['hypercubes'] )
? $refs[ $roleKey ]['hypercubes']
: array();
} | php | public function getPresentationRoleHypercubes( $roleKey )
{
/**
* @var array $refs
*/
$refs = $this->context->presentationRoleRefs;
if ( ! isset( $refs[ $roleKey ] ) ) return array();
return isset( $refs[ $roleKey ]['hypercubes'] )
? $refs[ $roleKey ]['hypercubes']
: array();
} | [
"public",
"function",
"getPresentationRoleHypercubes",
"(",
"$",
"roleKey",
")",
"{",
"/**\r\n\t\t * @var array $refs\r\n\t\t */",
"$",
"refs",
"=",
"$",
"this",
"->",
"context",
"->",
"presentationRoleRefs",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"refs",
"[",
... | Get the Hypercubes for a presentation role
@param string $roleKey Find hypercubes for a role with this key | [
"Get",
"the",
"Hypercubes",
"for",
"a",
"presentation",
"role"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L2297-L2308 | train |
bseddon/XBRL | XBRL.php | XBRL.& | public function &getPresentationRoleRefs( $filter = array(), $sort = true )
{
// Make sure the filter is initialized and contains lowercase values
if ( ! is_array( $filter ) ) $filter = array();
$filter = array_flip( array_map( 'strtolower', $filter ) );
/**
* @var array $refs
*/
$refs = $this->context->presentationRoleRefs;
/**
* @var array $result
*/
$result = array();
foreach ( $refs as $refKey => $ref )
{
// Apply the filter if one is provided
if ( count( $filter ) && ! isset( $filter[ strtolower( $refKey ) ] ) ) continue;
// The presentation hierarchy may be implemented in another taxonomy
if ( isset( $ref['hierarchy'] ) )
{
$result[ $refKey ] = $ref;
}
else
{
$result[ $refKey ] = $this->context->presentationRoleRefs[ $refKey ];
}
$result[ $refKey ]['text'] = $this->getPresentationLinkRoleDescription( $ref );
}
if ( $sort )
{
$this->sortRoleRefs( $result );
}
return $result;
} | php | public function &getPresentationRoleRefs( $filter = array(), $sort = true )
{
// Make sure the filter is initialized and contains lowercase values
if ( ! is_array( $filter ) ) $filter = array();
$filter = array_flip( array_map( 'strtolower', $filter ) );
/**
* @var array $refs
*/
$refs = $this->context->presentationRoleRefs;
/**
* @var array $result
*/
$result = array();
foreach ( $refs as $refKey => $ref )
{
// Apply the filter if one is provided
if ( count( $filter ) && ! isset( $filter[ strtolower( $refKey ) ] ) ) continue;
// The presentation hierarchy may be implemented in another taxonomy
if ( isset( $ref['hierarchy'] ) )
{
$result[ $refKey ] = $ref;
}
else
{
$result[ $refKey ] = $this->context->presentationRoleRefs[ $refKey ];
}
$result[ $refKey ]['text'] = $this->getPresentationLinkRoleDescription( $ref );
}
if ( $sort )
{
$this->sortRoleRefs( $result );
}
return $result;
} | [
"public",
"function",
"&",
"getPresentationRoleRefs",
"(",
"$",
"filter",
"=",
"array",
"(",
")",
",",
"$",
"sort",
"=",
"true",
")",
"{",
"// Make sure the filter is initialized and contains lowercase values\r",
"if",
"(",
"!",
"is_array",
"(",
"$",
"filter",
")"... | Provide access to the private presentationRoleRefs array
@param array[string]|null $filter
@param boolean $sort
@return void | [
"Provide",
"access",
"to",
"the",
"private",
"presentationRoleRefs",
"array"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L2316-L2355 | train |
bseddon/XBRL | XBRL.php | XBRL.getAllDefinitionRoles | public function getAllDefinitionRoles( $rebuildCache = false )
{
if ( $rebuildCache || is_null( $this->context->definitionLinkRolesCache ) )
{
$definitionLinkRoles = array();
// Time to build the cache
foreach ( $this->context->importedSchemas as $id => $taxonomy )
{
$roles = $taxonomy->getDefinitionRoleRefs();
foreach ( $roles as $roleUri => $role )
{
if ( count( $role ) <= 3 || isset( $definitionLinkRoles[ $roleUri ] ) ) continue;
$definitionLinkRoles[ $roleUri ] = $taxonomy->getSchemaLocation();
}
}
$this->context->definitionLinkRolesCache = $definitionLinkRoles;
}
return $this->context->definitionLinkRolesCache;
} | php | public function getAllDefinitionRoles( $rebuildCache = false )
{
if ( $rebuildCache || is_null( $this->context->definitionLinkRolesCache ) )
{
$definitionLinkRoles = array();
// Time to build the cache
foreach ( $this->context->importedSchemas as $id => $taxonomy )
{
$roles = $taxonomy->getDefinitionRoleRefs();
foreach ( $roles as $roleUri => $role )
{
if ( count( $role ) <= 3 || isset( $definitionLinkRoles[ $roleUri ] ) ) continue;
$definitionLinkRoles[ $roleUri ] = $taxonomy->getSchemaLocation();
}
}
$this->context->definitionLinkRolesCache = $definitionLinkRoles;
}
return $this->context->definitionLinkRolesCache;
} | [
"public",
"function",
"getAllDefinitionRoles",
"(",
"$",
"rebuildCache",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"rebuildCache",
"||",
"is_null",
"(",
"$",
"this",
"->",
"context",
"->",
"definitionLinkRolesCache",
")",
")",
"{",
"$",
"definitionLinkRoles",
"=... | Return a list of all roles with their taxonomy xsd using a cache if available
@param array $rebuildCache
@return array A list of roles | [
"Return",
"a",
"list",
"of",
"all",
"roles",
"with",
"their",
"taxonomy",
"xsd",
"using",
"a",
"cache",
"if",
"available"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L2362-L2385 | train |
bseddon/XBRL | XBRL.php | XBRL.getDefinitionHypercubes | public function getDefinitionHypercubes()
{
if ( $this->hypercubesCache !== null ) return $this->hypercubesCache;
$hypercubes = array();
foreach ( $this->getDefinitionRoleRefs() as $roleRefsKey => $role )
{
$hypercubes += $this->getDefinitionRoleHypercubes( $roleRefsKey );
}
$this->hypercubesCache = $hypercubes;
return $hypercubes;
} | php | public function getDefinitionHypercubes()
{
if ( $this->hypercubesCache !== null ) return $this->hypercubesCache;
$hypercubes = array();
foreach ( $this->getDefinitionRoleRefs() as $roleRefsKey => $role )
{
$hypercubes += $this->getDefinitionRoleHypercubes( $roleRefsKey );
}
$this->hypercubesCache = $hypercubes;
return $hypercubes;
} | [
"public",
"function",
"getDefinitionHypercubes",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hypercubesCache",
"!==",
"null",
")",
"return",
"$",
"this",
"->",
"hypercubesCache",
";",
"$",
"hypercubes",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
... | Provide access to the definitionRole Hypercubes array
@return array | [
"Provide",
"access",
"to",
"the",
"definitionRole",
"Hypercubes",
"array"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L2488-L2501 | train |
bseddon/XBRL | XBRL.php | XBRL.getDefinitionRoleLocatorFragment | public function getDefinitionRoleLocatorFragment( $roleRefsKey, $locator )
{
$result = $this->getDefinitionRoleLocator( $roleRefsKey, $locator );
return $result ? parse_url( $result, PHP_URL_FRAGMENT ) : false;
} | php | public function getDefinitionRoleLocatorFragment( $roleRefsKey, $locator )
{
$result = $this->getDefinitionRoleLocator( $roleRefsKey, $locator );
return $result ? parse_url( $result, PHP_URL_FRAGMENT ) : false;
} | [
"public",
"function",
"getDefinitionRoleLocatorFragment",
"(",
"$",
"roleRefsKey",
",",
"$",
"locator",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getDefinitionRoleLocator",
"(",
"$",
"roleRefsKey",
",",
"$",
"locator",
")",
";",
"return",
"$",
"result"... | Get the fragment from the value for a specific locator in a role
@param string $roleRefsKey
@param string $locator | [
"Get",
"the",
"fragment",
"from",
"the",
"value",
"for",
"a",
"specific",
"locator",
"in",
"a",
"role"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L2547-L2551 | train |
bseddon/XBRL | XBRL.php | XBRL.getDefinitionRoleLocatorSchema | public function getDefinitionRoleLocatorSchema( $roleRefsKey, $locator )
{
$result = $this->getDefinitionRoleLocator( $roleRefsKey, $locator );
return $result ? parse_url( $result, PHP_URL_PATH ) : false;
} | php | public function getDefinitionRoleLocatorSchema( $roleRefsKey, $locator )
{
$result = $this->getDefinitionRoleLocator( $roleRefsKey, $locator );
return $result ? parse_url( $result, PHP_URL_PATH ) : false;
} | [
"public",
"function",
"getDefinitionRoleLocatorSchema",
"(",
"$",
"roleRefsKey",
",",
"$",
"locator",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getDefinitionRoleLocator",
"(",
"$",
"roleRefsKey",
",",
"$",
"locator",
")",
";",
"return",
"$",
"result",
... | Get the schema from the value for a specific locator in a role
@param string $roleRefsKey
@param string $locator | [
"Get",
"the",
"schema",
"from",
"the",
"value",
"for",
"a",
"specific",
"locator",
"in",
"a",
"role"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L2558-L2562 | train |
bseddon/XBRL | XBRL.php | XBRL.getDefinitionRoleLocator | public function getDefinitionRoleLocator( $roleRefsKey, $locator )
{
$locators = $this->getDefinitionRoleLocators( $roleRefsKey );
return $locators && isset( $locators[ $locator ] ) ? $locators[ $locator ] : false;
} | php | public function getDefinitionRoleLocator( $roleRefsKey, $locator )
{
$locators = $this->getDefinitionRoleLocators( $roleRefsKey );
return $locators && isset( $locators[ $locator ] ) ? $locators[ $locator ] : false;
} | [
"public",
"function",
"getDefinitionRoleLocator",
"(",
"$",
"roleRefsKey",
",",
"$",
"locator",
")",
"{",
"$",
"locators",
"=",
"$",
"this",
"->",
"getDefinitionRoleLocators",
"(",
"$",
"roleRefsKey",
")",
";",
"return",
"$",
"locators",
"&&",
"isset",
"(",
... | Get the value for a specific locator in a role
@param string $roleRefsKey
@param string $locator | [
"Get",
"the",
"value",
"for",
"a",
"specific",
"locator",
"in",
"a",
"role"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L2569-L2573 | train |
bseddon/XBRL | XBRL.php | XBRL.getDefinitionRoleLocators | public function getDefinitionRoleLocators( $roleRefsKey )
{
if ( ! isset( $this->definitionRoleRefs[ $roleRefsKey ] ) ) return array();
$role = $this->definitionRoleRefs[ $roleRefsKey ];
if ( strpos( $role['href'], $this->getTaxonomyXSD() ) === false )
{
return $this->getTaxonomyForXSD( $role['href'] )->getDefinitionRoleLocators( $roleRefsKey );
}
return isset( $role['locators'] ) ? $role['locators'] : array();
} | php | public function getDefinitionRoleLocators( $roleRefsKey )
{
if ( ! isset( $this->definitionRoleRefs[ $roleRefsKey ] ) ) return array();
$role = $this->definitionRoleRefs[ $roleRefsKey ];
if ( strpos( $role['href'], $this->getTaxonomyXSD() ) === false )
{
return $this->getTaxonomyForXSD( $role['href'] )->getDefinitionRoleLocators( $roleRefsKey );
}
return isset( $role['locators'] ) ? $role['locators'] : array();
} | [
"public",
"function",
"getDefinitionRoleLocators",
"(",
"$",
"roleRefsKey",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"definitionRoleRefs",
"[",
"$",
"roleRefsKey",
"]",
")",
")",
"return",
"array",
"(",
")",
";",
"$",
"role",
"=",
"$",
... | Get the locators associated with this role
@param string $roleRefsKey | [
"Get",
"the",
"locators",
"associated",
"with",
"this",
"role"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L2579-L2588 | train |
bseddon/XBRL | XBRL.php | XBRL.getDefinitionDimensions | public function getDefinitionDimensions()
{
if ( $this->dimensionsCache !== null ) return $this->dimensionsCache;
$dimensions = array();
$taxonomy_base_name = $this->getTaxonomyXSD();
foreach ( $this->getDefinitionRoleRefs() as $roleRefsKey => $role )
{
$dimensions += $this->getDefinitionRoleDimensions( $roleRefsKey );
}
$this->dimensionsCache = $dimensions;
return $dimensions;
} | php | public function getDefinitionDimensions()
{
if ( $this->dimensionsCache !== null ) return $this->dimensionsCache;
$dimensions = array();
$taxonomy_base_name = $this->getTaxonomyXSD();
foreach ( $this->getDefinitionRoleRefs() as $roleRefsKey => $role )
{
$dimensions += $this->getDefinitionRoleDimensions( $roleRefsKey );
}
$this->dimensionsCache = $dimensions;
return $dimensions;
} | [
"public",
"function",
"getDefinitionDimensions",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"dimensionsCache",
"!==",
"null",
")",
"return",
"$",
"this",
"->",
"dimensionsCache",
";",
"$",
"dimensions",
"=",
"array",
"(",
")",
";",
"$",
"taxonomy_base_name... | Provide access to the definitionRole dimensions array | [
"Provide",
"access",
"to",
"the",
"definitionRole",
"dimensions",
"array"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L2625-L2639 | train |
bseddon/XBRL | XBRL.php | XBRL.getDefinitionDimensionMembers | public function getDefinitionDimensionMembers()
{
if ( $this->dimensionMembersCache !== null ) return $this->dimensionMembersCache;
$dimensionMembers = array();
foreach ( $this->getDefinitionRoleRefs() as $roleRefsKey => $role )
{
$dimensionMembers += $this->getDefinitionRoleDimensionMembers( $roleRefsKey );
}
$this->dimensionMembersCache = $dimensionMembers;
return $dimensionMembers;
} | php | public function getDefinitionDimensionMembers()
{
if ( $this->dimensionMembersCache !== null ) return $this->dimensionMembersCache;
$dimensionMembers = array();
foreach ( $this->getDefinitionRoleRefs() as $roleRefsKey => $role )
{
$dimensionMembers += $this->getDefinitionRoleDimensionMembers( $roleRefsKey );
}
$this->dimensionMembersCache = $dimensionMembers;
return $dimensionMembers;
} | [
"public",
"function",
"getDefinitionDimensionMembers",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"dimensionMembersCache",
"!==",
"null",
")",
"return",
"$",
"this",
"->",
"dimensionMembersCache",
";",
"$",
"dimensionMembers",
"=",
"array",
"(",
")",
";",
"f... | Provide access to the definitionRole dimension members array | [
"Provide",
"access",
"to",
"the",
"definitionRole",
"dimension",
"members",
"array"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L3052-L3065 | train |
bseddon/XBRL | XBRL.php | XBRL.getDefinitionRoleDimensionMembers | public function getDefinitionRoleDimensionMembers( $roleRefsKey )
{
$roles = $this->getAllDefinitionRoles();
if ( ! isset( $roles[ $roleRefsKey ] ) )
{
return array();
}
$taxonomy = $this->getTaxonomyForXSD( $roles[ $roleRefsKey ] );
$role = $taxonomy->getDefinitionRoleRef( $roleRefsKey );
return isset( $role['members'] )
? $role['members']
: array();
/*
$roleMembers = array();
if ( ! isset( $this->definitionRoleRefs[ $roleRefsKey ] ) ) return array();
$role = $this->definitionRoleRefs[ $roleRefsKey ];
if ( isset( $role['members'] ) && count( $role['members'] ) )
{
$roleMembers = $role['members'];
}
else if ( isset( $role['hypercubes'] ) && count( $role['hypercubes'] ) )
{
foreach ( $role['hypercubes'] as $hypercubeLabel => $hypercube )
{
foreach ( $hypercube['dimensions'] as $dimLabel => $dimension )
{
if ( ! isset( $dimension['targetRole'] ) ) continue;
$taxonomy = $this->getTaxonomyForNamespace( $dimension['member_namespace'] );
if ( ! $taxonomy )
{
$this->log()->dimension_validation( "dimensions", "A taxonomy cannot be found corresponding to a namespace", array(
'dimension' => "'$dimLabel'",
'namespace' => $dimension['member_namespace'] ? "'{$dimension['member_namespace']}'" : "Undefined",
) );
continue;
}
$roleMembers += $taxonomy->getDefinitionRoleDimensionMembers( $dimension['targetRole'] );
}
}
return $roleMembers;
}
else if ( strpos( $role['href'], $this->getTaxonomyXSD() ) === false )
{
$roleMembers = $this->getTaxonomyForXSD( $role['href'] )->getDefinitionRoleDimensionMembers( $roleRefsKey );
return $roleMembers;
}
foreach ( $roleMembers as $memberKey => $member )
{
if ( ! isset( $roleMembers[ $memberKey ]['roles'] ) )
{
$roleMembers[ $memberKey ]['roles'] = $roleRefsKey;
}
else
{
// Add unique roleRefsKey
if ( in_array( $roleRefsKey, $roleMembers[ $memberKey ]['roles'] ) ) continue;
$roleMembers[ $memberKey ]['roles'][] = $roleRefsKey;
}
}
return $roleMembers;
$result = array();
foreach ( $roleMembers as $memberKey => $member )
{
if ( ! isset( $result[ $memberKey ] ) )
{
$result[ $memberKey ] = array( 'href' => $member, 'roles' => array( $roleRefsKey ) );
continue;
}
// Add unique roleRefsKey
if ( in_array( $roleRefsKey, $result[ $memberKey ]['roles'] ) ) continue;
$result[ $memberKey ]['roles'][] = $roleRefsKey;
}
return $result;
*/
} | php | public function getDefinitionRoleDimensionMembers( $roleRefsKey )
{
$roles = $this->getAllDefinitionRoles();
if ( ! isset( $roles[ $roleRefsKey ] ) )
{
return array();
}
$taxonomy = $this->getTaxonomyForXSD( $roles[ $roleRefsKey ] );
$role = $taxonomy->getDefinitionRoleRef( $roleRefsKey );
return isset( $role['members'] )
? $role['members']
: array();
/*
$roleMembers = array();
if ( ! isset( $this->definitionRoleRefs[ $roleRefsKey ] ) ) return array();
$role = $this->definitionRoleRefs[ $roleRefsKey ];
if ( isset( $role['members'] ) && count( $role['members'] ) )
{
$roleMembers = $role['members'];
}
else if ( isset( $role['hypercubes'] ) && count( $role['hypercubes'] ) )
{
foreach ( $role['hypercubes'] as $hypercubeLabel => $hypercube )
{
foreach ( $hypercube['dimensions'] as $dimLabel => $dimension )
{
if ( ! isset( $dimension['targetRole'] ) ) continue;
$taxonomy = $this->getTaxonomyForNamespace( $dimension['member_namespace'] );
if ( ! $taxonomy )
{
$this->log()->dimension_validation( "dimensions", "A taxonomy cannot be found corresponding to a namespace", array(
'dimension' => "'$dimLabel'",
'namespace' => $dimension['member_namespace'] ? "'{$dimension['member_namespace']}'" : "Undefined",
) );
continue;
}
$roleMembers += $taxonomy->getDefinitionRoleDimensionMembers( $dimension['targetRole'] );
}
}
return $roleMembers;
}
else if ( strpos( $role['href'], $this->getTaxonomyXSD() ) === false )
{
$roleMembers = $this->getTaxonomyForXSD( $role['href'] )->getDefinitionRoleDimensionMembers( $roleRefsKey );
return $roleMembers;
}
foreach ( $roleMembers as $memberKey => $member )
{
if ( ! isset( $roleMembers[ $memberKey ]['roles'] ) )
{
$roleMembers[ $memberKey ]['roles'] = $roleRefsKey;
}
else
{
// Add unique roleRefsKey
if ( in_array( $roleRefsKey, $roleMembers[ $memberKey ]['roles'] ) ) continue;
$roleMembers[ $memberKey ]['roles'][] = $roleRefsKey;
}
}
return $roleMembers;
$result = array();
foreach ( $roleMembers as $memberKey => $member )
{
if ( ! isset( $result[ $memberKey ] ) )
{
$result[ $memberKey ] = array( 'href' => $member, 'roles' => array( $roleRefsKey ) );
continue;
}
// Add unique roleRefsKey
if ( in_array( $roleRefsKey, $result[ $memberKey ]['roles'] ) ) continue;
$result[ $memberKey ]['roles'][] = $roleRefsKey;
}
return $result;
*/
} | [
"public",
"function",
"getDefinitionRoleDimensionMembers",
"(",
"$",
"roleRefsKey",
")",
"{",
"$",
"roles",
"=",
"$",
"this",
"->",
"getAllDefinitionRoles",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"roles",
"[",
"$",
"roleRefsKey",
"]",
")",
")",
... | Provide access to the definitionRole dimension members array for a specific role
@param string $roleRefsKey The name of the role
@return array A list of dimension members | [
"Provide",
"access",
"to",
"the",
"definitionRole",
"dimension",
"members",
"array",
"for",
"a",
"specific",
"role"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L3072-L3159 | train |
bseddon/XBRL | XBRL.php | XBRL.getDefinitionRoleDimensionMemberHierarchy | public function getDefinitionRoleDimensionMemberHierarchy( $role )
{
return ! isset( $this->definitionRoleRefs[ $role ]['hierarchy'] ) ||
count( $this->definitionRoleRefs[ $role ]['hierarchy'] ) === 0
? array()
: $this->definitionRoleRefs[ $role ]['hierarchy'];
} | php | public function getDefinitionRoleDimensionMemberHierarchy( $role )
{
return ! isset( $this->definitionRoleRefs[ $role ]['hierarchy'] ) ||
count( $this->definitionRoleRefs[ $role ]['hierarchy'] ) === 0
? array()
: $this->definitionRoleRefs[ $role ]['hierarchy'];
} | [
"public",
"function",
"getDefinitionRoleDimensionMemberHierarchy",
"(",
"$",
"role",
")",
"{",
"return",
"!",
"isset",
"(",
"$",
"this",
"->",
"definitionRoleRefs",
"[",
"$",
"role",
"]",
"[",
"'hierarchy'",
"]",
")",
"||",
"count",
"(",
"$",
"this",
"->",
... | Provide access to the definitionRole dimension hierarchy for a specific role
@param string $role The name of the role
@return array A list of primary items | [
"Provide",
"access",
"to",
"the",
"definitionRole",
"dimension",
"hierarchy",
"for",
"a",
"specific",
"role"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L3166-L3172 | train |
bseddon/XBRL | XBRL.php | XBRL.getDefinitionRoleDimensionMemberPaths | public function getDefinitionRoleDimensionMemberPaths( $role )
{
return ! isset( $this->definitionRoleRefs[ $role ]['paths'] ) ||
count( $this->definitionRoleRefs[ $role ]['paths'] ) === 0
? array()
: $this->definitionRoleRefs[ $role ]['paths'];
} | php | public function getDefinitionRoleDimensionMemberPaths( $role )
{
return ! isset( $this->definitionRoleRefs[ $role ]['paths'] ) ||
count( $this->definitionRoleRefs[ $role ]['paths'] ) === 0
? array()
: $this->definitionRoleRefs[ $role ]['paths'];
} | [
"public",
"function",
"getDefinitionRoleDimensionMemberPaths",
"(",
"$",
"role",
")",
"{",
"return",
"!",
"isset",
"(",
"$",
"this",
"->",
"definitionRoleRefs",
"[",
"$",
"role",
"]",
"[",
"'paths'",
"]",
")",
"||",
"count",
"(",
"$",
"this",
"->",
"defini... | Provide access to the definitionRole dimension member paths for a specific role
@param string $role The name of the role
@return array A list of primary items | [
"Provide",
"access",
"to",
"the",
"definitionRole",
"dimension",
"member",
"paths",
"for",
"a",
"specific",
"role"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L3179-L3185 | train |
bseddon/XBRL | XBRL.php | XBRL.summarizeNodes | public function summarizeNodes( $nodes, $locators, $options = array() )
{
$result = array();
if ( ! $options || ! is_array( $options ) ) $options = array();
if ( ! isset( $options['collectionName'] ) ) $options['collectionName'] = 'children';
if ( ! isset( $options['labelName'] ) ) $options['labelName'] = 'label';
if ( ! isset( $options['description'] ) ) $options['description'] = 'true';
$options['indent'] = isset( $options['indent'] ) ? $options['indent'] + 1 : 0;
$taxonomy_base_name = $this->getTaxonomyXSD();
foreach ( $nodes as $nodeKey => $node )
{
$index = $node[ $options['labelName'] ];
if ( isset( $node['arcrole'] ) ) $index .= " ({$node['arcrole']})";
if ( isset( $node['order'] ) ) $index .= " ({$node['order']})";
if ( isset( $node['targetRole'] ) ) $index .= " ->({$node['targetRole']})";
// $this->log()->info( isset( $locators[ $node[ $labelName ] ] )
// ? "Locator found {$locators[ $node[ $labelName ] ]}\n"
// : "Locator not found" );
// $taxonomy = strpos( $locators[ $node[ $options['labelName'] ] ], $taxonomy_base_name ) === 0
// ? $this
// : $this->getTaxonomyForXSD( $locators[ $node[ $options['labelName'] ] ] );
if ( $options['description'] )
{
$description = $this->getTaxonomyDescriptionForIdWithDefaults( $node[ $options['labelName'] ], null, getDefaultLanguage() );
if ( $description !== false )
{
$index .= " '$description'";
}
}
if ( isset( $node['nodeclass'] ) )
$index .= " ({$node['nodeclass']})";
if ( isset( $options['callback'] ) )
{
if ( $callback_string = call_user_func( array( $this, $options['callback'] ), $node, $taxonomy ) )
{
$index .= " [$callback_string]";
}
}
$leaf = "Leaf";
$result[ $index ] = $leaf;
if ( ! isset( $node[ $options['collectionName'] ] ) ) continue;
$result[ $index ] = $this->summarizeNodes( $node[ $options['collectionName'] ], $locators, $options );
}
return $result;
} | php | public function summarizeNodes( $nodes, $locators, $options = array() )
{
$result = array();
if ( ! $options || ! is_array( $options ) ) $options = array();
if ( ! isset( $options['collectionName'] ) ) $options['collectionName'] = 'children';
if ( ! isset( $options['labelName'] ) ) $options['labelName'] = 'label';
if ( ! isset( $options['description'] ) ) $options['description'] = 'true';
$options['indent'] = isset( $options['indent'] ) ? $options['indent'] + 1 : 0;
$taxonomy_base_name = $this->getTaxonomyXSD();
foreach ( $nodes as $nodeKey => $node )
{
$index = $node[ $options['labelName'] ];
if ( isset( $node['arcrole'] ) ) $index .= " ({$node['arcrole']})";
if ( isset( $node['order'] ) ) $index .= " ({$node['order']})";
if ( isset( $node['targetRole'] ) ) $index .= " ->({$node['targetRole']})";
// $this->log()->info( isset( $locators[ $node[ $labelName ] ] )
// ? "Locator found {$locators[ $node[ $labelName ] ]}\n"
// : "Locator not found" );
// $taxonomy = strpos( $locators[ $node[ $options['labelName'] ] ], $taxonomy_base_name ) === 0
// ? $this
// : $this->getTaxonomyForXSD( $locators[ $node[ $options['labelName'] ] ] );
if ( $options['description'] )
{
$description = $this->getTaxonomyDescriptionForIdWithDefaults( $node[ $options['labelName'] ], null, getDefaultLanguage() );
if ( $description !== false )
{
$index .= " '$description'";
}
}
if ( isset( $node['nodeclass'] ) )
$index .= " ({$node['nodeclass']})";
if ( isset( $options['callback'] ) )
{
if ( $callback_string = call_user_func( array( $this, $options['callback'] ), $node, $taxonomy ) )
{
$index .= " [$callback_string]";
}
}
$leaf = "Leaf";
$result[ $index ] = $leaf;
if ( ! isset( $node[ $options['collectionName'] ] ) ) continue;
$result[ $index ] = $this->summarizeNodes( $node[ $options['collectionName'] ], $locators, $options );
}
return $result;
} | [
"public",
"function",
"summarizeNodes",
"(",
"$",
"nodes",
",",
"$",
"locators",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"$",
"options",
"||",
"!",
"is_array",
"(",
"$",
"... | Creates a summary of a collection of nodes that are arganized in to a hierarchy such as presentation and definition link bases.
The requirements of the collection is that it is an associative array, that there is an element which is the label and one which
is a nested collection of nodes. This function is called recursively in a depth first manner to traverse the hierarchy.
@param array $nodes The array of nodes to summarize.
@param array $locators An array of locators for the role
@param array options An array of options with the following optional elements:
int 'indent' The indentation level for this iteration.
string 'labelName' The name of the element of each node that represents the label to include in the summary
string 'collectionName' The name of the element which references a nested collection of nodes if the node is not a leaf.
bool 'description' If not present or true, include a node decription in the output
function 'callback' A function to call for each node. The function will be passed the node and the taxonomy of the node
It will return a string that will be added to the description generated.
@return array A hierarchy summarizing the node hierarchy passed in | [
"Creates",
"a",
"summary",
"of",
"a",
"collection",
"of",
"nodes",
"that",
"are",
"arganized",
"in",
"to",
"a",
"hierarchy",
"such",
"as",
"presentation",
"and",
"definition",
"link",
"bases",
".",
"The",
"requirements",
"of",
"the",
"collection",
"is",
"tha... | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L3264-L3319 | train |
bseddon/XBRL | XBRL.php | XBRL.fromStore | protected function fromStore( $data )
{
// Fix up the schema location
if ( strpos( $data['schemaLocation'], '\\') !== false ) $data['schemaLocation'] = str_replace( '\\', '/', $data['schemaLocation'] );
if ( strpos( $data['schemaLocation'], './') ) $data['schemaLocation'] = XBRL::normalizePath( $data['schemaLocation'] );
$this->loadedFromJSON = true;
$this->elementIndex =& $data['elementIndex'];
$this->elementHypercubes =& $data['elementHypercubes'];
$this->elementDimensions =& $data['elementDimensions'];
$this->schemaLocation =& $data['schemaLocation'];
$this->namespace =& $data['namespace'];
$this->roleTypes =& $data['roleTypes'];
if ( isset( $data['roleTypeIds'] ) )
{
$this->roleTypeIds =& $data['roleTypeIds'];
}
$this->arcroleTypes =& $data['arcroleTypes'];
if ( isset( $data['arcroleTypeIds'] ) )
{
$this->arcroleTypeIds =& $data['arcroleTypeIds'];
}
$this->linkbaseTypes =& $data['linkbaseTypes'];
$this->definitionRoleRefs =& $data['definitionRoleRefs'];
$this->referenceRoleRefs =& $data['referenceRoleRefs'];
$this->stringsLoaded = $data['stringsLoaded'];
$this->documentPrefixes = $data['documentPrefixes'];
$this->xdtTargetRoles =& $data['xdtTargetRoles'];
$this->genericRoles =& $data['genericRoles'];
$this->variableSetNames =& $data['variableSetNames'];
$this->linkbaseIds =& $data['linkbaseIds'];
$this->hasFormulas =& $data['hasFormulas'];
$this->linkbases =& $data['linkbases'];
if ( ( $key = array_search( $this->namespace, $this->documentPrefixes ) ) !== false )
{
$this->prefix = $key;
}
else
{
$this->log()->warning("A prefix cannot be found among the document prefixes for the namespace '{$this->namespace}'");
}
if ( isset( $data['extraElements'] ) )
{
foreach ( $data['extraElements'] as $newElementLabel => $existingElementLabel )
{
$existingElementTaxonomy = $this->getTaxonomyForXSD( $existingElementLabel );
$element = $existingElementTaxonomy->getElementById( $existingElementLabel );
$newElementTaxonomy = $this->getTaxonomyForXSD( $newElementLabel );
$elements =& $newElementTaxonomy->getElements();
$elements[ substr( strstr( $newElementLabel, '#' ), 1 ) ] = $elements[ $element['id'] ];
}
}
// BMS 2018-09-09 Moved to $this->fixupForeignDefinitionsFromStore($schemas)
// if ( isset( $data['foreignDefinitionRoleRefs'] ) && $data['foreignDefinitionRoleRefs'] )
// {
// foreach( $data['foreignDefinitionRoleRefs'] as $definitionRoleRefKey => $definitionRoleRef )
// {
// $home_taxonomy = $this->getTaxonomyForXSD( $definitionRoleRef['href'] );
// if ( ! $home_taxonomy )
// {
// $ex = new \Exception("Unable to locate taxonomy instance for '{$definitionRoleRef['href']}'");
// // error_log($ex->getTraceAsString());
// throw $ex;
// }
// $roleRef =& $home_taxonomy->getDefinitionRoleRef( $definitionRoleRef['roleUri'] );
// $roleRef = $this->mergeExtendedRoles( $roleRef, $definitionRoleRef, $mergedRoles, false );
// $this->context->setPrimaryItemsCache( null );
// }
// }
} | php | protected function fromStore( $data )
{
// Fix up the schema location
if ( strpos( $data['schemaLocation'], '\\') !== false ) $data['schemaLocation'] = str_replace( '\\', '/', $data['schemaLocation'] );
if ( strpos( $data['schemaLocation'], './') ) $data['schemaLocation'] = XBRL::normalizePath( $data['schemaLocation'] );
$this->loadedFromJSON = true;
$this->elementIndex =& $data['elementIndex'];
$this->elementHypercubes =& $data['elementHypercubes'];
$this->elementDimensions =& $data['elementDimensions'];
$this->schemaLocation =& $data['schemaLocation'];
$this->namespace =& $data['namespace'];
$this->roleTypes =& $data['roleTypes'];
if ( isset( $data['roleTypeIds'] ) )
{
$this->roleTypeIds =& $data['roleTypeIds'];
}
$this->arcroleTypes =& $data['arcroleTypes'];
if ( isset( $data['arcroleTypeIds'] ) )
{
$this->arcroleTypeIds =& $data['arcroleTypeIds'];
}
$this->linkbaseTypes =& $data['linkbaseTypes'];
$this->definitionRoleRefs =& $data['definitionRoleRefs'];
$this->referenceRoleRefs =& $data['referenceRoleRefs'];
$this->stringsLoaded = $data['stringsLoaded'];
$this->documentPrefixes = $data['documentPrefixes'];
$this->xdtTargetRoles =& $data['xdtTargetRoles'];
$this->genericRoles =& $data['genericRoles'];
$this->variableSetNames =& $data['variableSetNames'];
$this->linkbaseIds =& $data['linkbaseIds'];
$this->hasFormulas =& $data['hasFormulas'];
$this->linkbases =& $data['linkbases'];
if ( ( $key = array_search( $this->namespace, $this->documentPrefixes ) ) !== false )
{
$this->prefix = $key;
}
else
{
$this->log()->warning("A prefix cannot be found among the document prefixes for the namespace '{$this->namespace}'");
}
if ( isset( $data['extraElements'] ) )
{
foreach ( $data['extraElements'] as $newElementLabel => $existingElementLabel )
{
$existingElementTaxonomy = $this->getTaxonomyForXSD( $existingElementLabel );
$element = $existingElementTaxonomy->getElementById( $existingElementLabel );
$newElementTaxonomy = $this->getTaxonomyForXSD( $newElementLabel );
$elements =& $newElementTaxonomy->getElements();
$elements[ substr( strstr( $newElementLabel, '#' ), 1 ) ] = $elements[ $element['id'] ];
}
}
// BMS 2018-09-09 Moved to $this->fixupForeignDefinitionsFromStore($schemas)
// if ( isset( $data['foreignDefinitionRoleRefs'] ) && $data['foreignDefinitionRoleRefs'] )
// {
// foreach( $data['foreignDefinitionRoleRefs'] as $definitionRoleRefKey => $definitionRoleRef )
// {
// $home_taxonomy = $this->getTaxonomyForXSD( $definitionRoleRef['href'] );
// if ( ! $home_taxonomy )
// {
// $ex = new \Exception("Unable to locate taxonomy instance for '{$definitionRoleRef['href']}'");
// // error_log($ex->getTraceAsString());
// throw $ex;
// }
// $roleRef =& $home_taxonomy->getDefinitionRoleRef( $definitionRoleRef['roleUri'] );
// $roleRef = $this->mergeExtendedRoles( $roleRef, $definitionRoleRef, $mergedRoles, false );
// $this->context->setPrimaryItemsCache( null );
// }
// }
} | [
"protected",
"function",
"fromStore",
"(",
"$",
"data",
")",
"{",
"// Fix up the schema location\r",
"if",
"(",
"strpos",
"(",
"$",
"data",
"[",
"'schemaLocation'",
"]",
",",
"'\\\\'",
")",
"!==",
"false",
")",
"$",
"data",
"[",
"'schemaLocation'",
"]",
"=",... | Populate an instance from stored data
@param array $data | [
"Populate",
"an",
"instance",
"from",
"stored",
"data"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L3404-L3478 | train |
bseddon/XBRL | XBRL.php | XBRL.toStore | public function toStore( $encode = false, $prettyPrint = false )
{
$store = array(
'elementIndex' => &$this->elementIndex,
'elementHypercubes' => &$this->elementHypercubes,
'elementDimensions' => &$this->elementDimensions,
'schemaLocation' => &$this->schemaLocation,
'namespace' => &$this->namespace,
'roleTypes' => &$this->roleTypes,
'roleTypeIds' => &$this->roleTypeIds,
'arcroleTypes' => &$this->arcroleTypes,
'arcroleTypeIds' => &$this->arcroleTypeIds,
'linkbaseTypes' => &$this->linkbaseTypes,
'definitionRoleRefs' => &$this->definitionRoleRefs,
'referenceRoleRefs' => &$this->referenceRoleRefs,
'xdtTargetRoles' => &$this->xdtTargetRoles,
'stringsLoaded' => $this->stringsAreLoaded(),
'documentPrefixes' => $this->documentPrefixes,
'genericRoles' => $this->genericRoles,
'variableSetNames' => $this->variableSetNames,
'linkbaseIds' => $this->linkbaseIds,
'hasFormulas' => $this->hasFormulas,
'linkbases' => $this->linkbases,
'foreignDefinitionRoleRefs' => &$this->foreignDefinitionRoleRefs,
);
if ( $this->context->isExtensionTaxonomy() && $this->extraElements )
{
$store['extraElements'] = $this->extraElements;
}
return $encode
? json_encode( $store, $prettyPrint ? JSON_PRETTY_PRINT : null )
: $store;
} | php | public function toStore( $encode = false, $prettyPrint = false )
{
$store = array(
'elementIndex' => &$this->elementIndex,
'elementHypercubes' => &$this->elementHypercubes,
'elementDimensions' => &$this->elementDimensions,
'schemaLocation' => &$this->schemaLocation,
'namespace' => &$this->namespace,
'roleTypes' => &$this->roleTypes,
'roleTypeIds' => &$this->roleTypeIds,
'arcroleTypes' => &$this->arcroleTypes,
'arcroleTypeIds' => &$this->arcroleTypeIds,
'linkbaseTypes' => &$this->linkbaseTypes,
'definitionRoleRefs' => &$this->definitionRoleRefs,
'referenceRoleRefs' => &$this->referenceRoleRefs,
'xdtTargetRoles' => &$this->xdtTargetRoles,
'stringsLoaded' => $this->stringsAreLoaded(),
'documentPrefixes' => $this->documentPrefixes,
'genericRoles' => $this->genericRoles,
'variableSetNames' => $this->variableSetNames,
'linkbaseIds' => $this->linkbaseIds,
'hasFormulas' => $this->hasFormulas,
'linkbases' => $this->linkbases,
'foreignDefinitionRoleRefs' => &$this->foreignDefinitionRoleRefs,
);
if ( $this->context->isExtensionTaxonomy() && $this->extraElements )
{
$store['extraElements'] = $this->extraElements;
}
return $encode
? json_encode( $store, $prettyPrint ? JSON_PRETTY_PRINT : null )
: $store;
} | [
"public",
"function",
"toStore",
"(",
"$",
"encode",
"=",
"false",
",",
"$",
"prettyPrint",
"=",
"false",
")",
"{",
"$",
"store",
"=",
"array",
"(",
"'elementIndex'",
"=>",
"&",
"$",
"this",
"->",
"elementIndex",
",",
"'elementHypercubes'",
"=>",
"&",
"$... | A function to record the relevant parts of an XBRL instance
@param boolean $encode True if the result is to be encoded
@param boolean $prettyPrint
@return array|string | [
"A",
"function",
"to",
"record",
"the",
"relevant",
"parts",
"of",
"an",
"XBRL",
"instance"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L3589-L3623 | train |
bseddon/XBRL | XBRL.php | XBRL.getAllElements | public function getAllElements()
{
if ( $this->context->isExtensionTaxonomy() )
{
$prefix = $this->getPrefix();
return array_map( function( $item ) use ( $prefix ) { $item['prefix'] = $prefix; return $item; }, $this->elementIndex );
}
$result = array();
foreach ( $this->context->importedSchemas as $namespace => $taxonomy )
{
$elements = $taxonomy->getElements();
if ( ! $elements ) continue; // Don't attempt to merge if there are no element and it take time
$prefix = $taxonomy->getPrefix();
$elements = array_map( function( $item ) use ( $prefix ) { $item['prefix'] = $prefix; return $item; }, $elements );
$result = array_merge( $result, $elements );
}
return $result;
} | php | public function getAllElements()
{
if ( $this->context->isExtensionTaxonomy() )
{
$prefix = $this->getPrefix();
return array_map( function( $item ) use ( $prefix ) { $item['prefix'] = $prefix; return $item; }, $this->elementIndex );
}
$result = array();
foreach ( $this->context->importedSchemas as $namespace => $taxonomy )
{
$elements = $taxonomy->getElements();
if ( ! $elements ) continue; // Don't attempt to merge if there are no element and it take time
$prefix = $taxonomy->getPrefix();
$elements = array_map( function( $item ) use ( $prefix ) { $item['prefix'] = $prefix; return $item; }, $elements );
$result = array_merge( $result, $elements );
}
return $result;
} | [
"public",
"function",
"getAllElements",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"context",
"->",
"isExtensionTaxonomy",
"(",
")",
")",
"{",
"$",
"prefix",
"=",
"$",
"this",
"->",
"getPrefix",
"(",
")",
";",
"return",
"array_map",
"(",
"function",
... | Returns an array of elements across all taxonomies
@return array | [
"Returns",
"an",
"array",
"of",
"elements",
"across",
"all",
"taxonomies"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L3809-L3827 | train |
bseddon/XBRL | XBRL.php | XBRL.getHasFormulas | public function getHasFormulas( $checkAllSchemas = false )
{
if ( ! $checkAllSchemas )
{
return $this->hasFormulas;
}
// Check to see if any of the schemas
foreach ( $this->context->importedSchemas as $namespace => $taxonomy )
{
if ( $taxonomy->getHasFormulas() ) return true;
}
return false;
} | php | public function getHasFormulas( $checkAllSchemas = false )
{
if ( ! $checkAllSchemas )
{
return $this->hasFormulas;
}
// Check to see if any of the schemas
foreach ( $this->context->importedSchemas as $namespace => $taxonomy )
{
if ( $taxonomy->getHasFormulas() ) return true;
}
return false;
} | [
"public",
"function",
"getHasFormulas",
"(",
"$",
"checkAllSchemas",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"checkAllSchemas",
")",
"{",
"return",
"$",
"this",
"->",
"hasFormulas",
";",
"}",
"// Check to see if any of the schemas\r",
"foreach",
"(",
"$",
... | Returns the flag indicating whether or not the taxonomy includes formulas
@param bool $checkAllSchemas (optional) Forces the test to look at all taxonomies and return true if any one taxonomy has formulas
@return boolean | [
"Returns",
"the",
"flag",
"indicating",
"whether",
"or",
"not",
"the",
"taxonomy",
"includes",
"formulas"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L3863-L3877 | train |
bseddon/XBRL | XBRL.php | XBRL.getTupleElements | public function getTupleElements()
{
if ( $this->tupleElements === null )
{
$this->tupleElements = array_filter( $this->elementIndex, function( $item ) { return $item['substitutionGroup'] === XBRL_Constants::$xbrliTuple; } );
}
return $this->tupleElements;
} | php | public function getTupleElements()
{
if ( $this->tupleElements === null )
{
$this->tupleElements = array_filter( $this->elementIndex, function( $item ) { return $item['substitutionGroup'] === XBRL_Constants::$xbrliTuple; } );
}
return $this->tupleElements;
} | [
"public",
"function",
"getTupleElements",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"tupleElements",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"tupleElements",
"=",
"array_filter",
"(",
"$",
"this",
"->",
"elementIndex",
",",
"function",
"(",
"$",
"... | Get a list of the elements that are tuples
@return array | [
"Get",
"a",
"list",
"of",
"the",
"elements",
"that",
"are",
"tuples"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L3889-L3897 | train |
bseddon/XBRL | XBRL.php | XBRL.& | public function &getElementById( $id )
{
$id = urldecode( $id );
$fragment = parse_url( $id, PHP_URL_FRAGMENT );
$fragment = $fragment ? $fragment : $id;
if ( ! isset( $this->elementIndex[ $fragment ] ) )
{
$false = false;
return $false;
}
$element = &$this->elementIndex[ $fragment ];
return $element;
} | php | public function &getElementById( $id )
{
$id = urldecode( $id );
$fragment = parse_url( $id, PHP_URL_FRAGMENT );
$fragment = $fragment ? $fragment : $id;
if ( ! isset( $this->elementIndex[ $fragment ] ) )
{
$false = false;
return $false;
}
$element = &$this->elementIndex[ $fragment ];
return $element;
} | [
"public",
"function",
"&",
"getElementById",
"(",
"$",
"id",
")",
"{",
"$",
"id",
"=",
"urldecode",
"(",
"$",
"id",
")",
";",
"$",
"fragment",
"=",
"parse_url",
"(",
"$",
"id",
",",
"PHP_URL_FRAGMENT",
")",
";",
"$",
"fragment",
"=",
"$",
"fragment",... | Gets an element based on its id
@param string $id The id of the element to return
@return Array An element array or false | [
"Gets",
"an",
"element",
"based",
"on",
"its",
"id"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L3945-L3959 | train |
bseddon/XBRL | XBRL.php | XBRL.& | public function &getElementByName( $name )
{
$defaultResult = array();
if ( ! property_exists( $this, 'elements_by_name' ) )
{
$this->elements_by_name = array();
foreach ( $this->elementIndex as $elementsKey => &$element )
{
$this->elements_by_name[ $element['name'] ] = &$element;
}
}
if ( isset( $this->elements_by_name[ $name ] ) )
{
return $this->elements_by_name[ $name ];
}
return $defaultResult;
return isset( $this->elements_by_name[ $name ] ) ? $this->elements_by_name[ $name ] : $defaultResult;
} | php | public function &getElementByName( $name )
{
$defaultResult = array();
if ( ! property_exists( $this, 'elements_by_name' ) )
{
$this->elements_by_name = array();
foreach ( $this->elementIndex as $elementsKey => &$element )
{
$this->elements_by_name[ $element['name'] ] = &$element;
}
}
if ( isset( $this->elements_by_name[ $name ] ) )
{
return $this->elements_by_name[ $name ];
}
return $defaultResult;
return isset( $this->elements_by_name[ $name ] ) ? $this->elements_by_name[ $name ] : $defaultResult;
} | [
"public",
"function",
"&",
"getElementByName",
"(",
"$",
"name",
")",
"{",
"$",
"defaultResult",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"property_exists",
"(",
"$",
"this",
",",
"'elements_by_name'",
")",
")",
"{",
"$",
"this",
"->",
"elements_by_n... | Gets an element based on its name
@param string $name The name of the element to return
@return An element array or false | [
"Gets",
"an",
"element",
"based",
"on",
"its",
"name"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L3966-L3987 | train |
bseddon/XBRL | XBRL.php | XBRL.resolveId | public function resolveId( $href, $link = null )
{
// Check the $href provided is valid
$parts = is_array( $href ) ? $href : parse_url( $href );
if ( ! isset( $parts['path'] ) || ! isset( $parts['fragment'] ) ) return false;
$id = $parts['fragment'];
$taxonomy = $this->getTaxonomyForXSD( $href );
if ( $taxonomy === false ) return false;
// The ID may belong to one of the elements
$elements =& $taxonomy->getElements();
return isset( $elements[ $id ] )
? $elements[ $id ]
: false;
} | php | public function resolveId( $href, $link = null )
{
// Check the $href provided is valid
$parts = is_array( $href ) ? $href : parse_url( $href );
if ( ! isset( $parts['path'] ) || ! isset( $parts['fragment'] ) ) return false;
$id = $parts['fragment'];
$taxonomy = $this->getTaxonomyForXSD( $href );
if ( $taxonomy === false ) return false;
// The ID may belong to one of the elements
$elements =& $taxonomy->getElements();
return isset( $elements[ $id ] )
? $elements[ $id ]
: false;
} | [
"public",
"function",
"resolveId",
"(",
"$",
"href",
",",
"$",
"link",
"=",
"null",
")",
"{",
"// Check the $href provided is valid\r",
"$",
"parts",
"=",
"is_array",
"(",
"$",
"href",
")",
"?",
"$",
"href",
":",
"parse_url",
"(",
"$",
"href",
")",
";",
... | Returns the node with ID that corresponds to the href.
@param $href string|array The href is likely to come from a locator and can be the string or an array produced by parse_url.
@param string $link A 'usedOn' value to select one of the roleTypes
@return string|boolean | [
"Returns",
"the",
"node",
"with",
"ID",
"that",
"corresponds",
"to",
"the",
"href",
"."
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L4013-L4028 | train |
bseddon/XBRL | XBRL.php | XBRL.getTaxonomyForQName | public function getTaxonomyForQName( $qname )
{
$prefix = $qname instanceof \QName
? $qname->localName
: strstr( $qname, ":", true );
return $this->getTaxonomyForPrefix( $prefix );
} | php | public function getTaxonomyForQName( $qname )
{
$prefix = $qname instanceof \QName
? $qname->localName
: strstr( $qname, ":", true );
return $this->getTaxonomyForPrefix( $prefix );
} | [
"public",
"function",
"getTaxonomyForQName",
"(",
"$",
"qname",
")",
"{",
"$",
"prefix",
"=",
"$",
"qname",
"instanceof",
"\\",
"QName",
"?",
"$",
"qname",
"->",
"localName",
":",
"strstr",
"(",
"$",
"qname",
",",
"\":\"",
",",
"true",
")",
";",
"retur... | Get the taxonomy that has the prefix used in the QName
@param string|\QName $prefix
@return XBRL | [
"Get",
"the",
"taxonomy",
"that",
"has",
"the",
"prefix",
"used",
"in",
"the",
"QName"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L4062-L4068 | train |
bseddon/XBRL | XBRL.php | XBRL.getTaxonomyForPrefix | public function getTaxonomyForPrefix( $prefix )
{
if ( ! $prefix ) return null;
$taxonomies = array_filter(
$this->getImportedSchemas(),
function( $taxonomy ) use( $prefix ) { return $taxonomy->getPrefix() == $prefix; }
);
if ( ! $taxonomies ) return null;
return reset( $taxonomies );
} | php | public function getTaxonomyForPrefix( $prefix )
{
if ( ! $prefix ) return null;
$taxonomies = array_filter(
$this->getImportedSchemas(),
function( $taxonomy ) use( $prefix ) { return $taxonomy->getPrefix() == $prefix; }
);
if ( ! $taxonomies ) return null;
return reset( $taxonomies );
} | [
"public",
"function",
"getTaxonomyForPrefix",
"(",
"$",
"prefix",
")",
"{",
"if",
"(",
"!",
"$",
"prefix",
")",
"return",
"null",
";",
"$",
"taxonomies",
"=",
"array_filter",
"(",
"$",
"this",
"->",
"getImportedSchemas",
"(",
")",
",",
"function",
"(",
"... | Get the taxonomy for the prefix. Taxonomies have unique prefixes.
@param string $prefix
@return XBRL | [
"Get",
"the",
"taxonomy",
"for",
"the",
"prefix",
".",
"Taxonomies",
"have",
"unique",
"prefixes",
"."
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L4075-L4085 | train |
bseddon/XBRL | XBRL.php | XBRL.getTaxonomyDescriptionForIdWithDefaults | public function getTaxonomyDescriptionForIdWithDefaults( $href, $roles = null, $lang = null, $extendedLinkRole = null )
{
$text = $this->getTaxonomyDescriptionForId( $href, $roles, $lang, $extendedLinkRole );
if ( $text !== false) return $text;
// Try some defaults unless the options are already the defaults
if (
(
( $roles == null ) ||
( $roles == XBRL_Constants::$labelRoleLabel ) ||
( is_array( $roles ) && in_array( XBRL_Constants::$labelRoleLabel, $roles ) )
) &&
( $lang == $this->getDefaultLanguage() || $lang == null )
) return false;
if ( $roles && $lang )
{
$text = $this->getTaxonomyDescriptionForId( $href, null, $lang, $extendedLinkRole );
if ( $text !== false) return $text;
}
return $this->getTaxonomyDescriptionForId( $href, null, null, $extendedLinkRole );
} | php | public function getTaxonomyDescriptionForIdWithDefaults( $href, $roles = null, $lang = null, $extendedLinkRole = null )
{
$text = $this->getTaxonomyDescriptionForId( $href, $roles, $lang, $extendedLinkRole );
if ( $text !== false) return $text;
// Try some defaults unless the options are already the defaults
if (
(
( $roles == null ) ||
( $roles == XBRL_Constants::$labelRoleLabel ) ||
( is_array( $roles ) && in_array( XBRL_Constants::$labelRoleLabel, $roles ) )
) &&
( $lang == $this->getDefaultLanguage() || $lang == null )
) return false;
if ( $roles && $lang )
{
$text = $this->getTaxonomyDescriptionForId( $href, null, $lang, $extendedLinkRole );
if ( $text !== false) return $text;
}
return $this->getTaxonomyDescriptionForId( $href, null, null, $extendedLinkRole );
} | [
"public",
"function",
"getTaxonomyDescriptionForIdWithDefaults",
"(",
"$",
"href",
",",
"$",
"roles",
"=",
"null",
",",
"$",
"lang",
"=",
"null",
",",
"$",
"extendedLinkRole",
"=",
"null",
")",
"{",
"$",
"text",
"=",
"$",
"this",
"->",
"getTaxonomyDescriptio... | Returns a description for an element identified by href and optionally a role and language
If a label cannot be found using the options and the options are not already the defaults, try the defaults.
@param string $href The id of the element for which a description is to be retrieved. If only the fragment is provided, its assumed to be from the current taxonomy.
@param null|string[] $roles (optional) If true include the element text in the result. If the argument is an array it will be an array of preferred labels.
@param null|string $lang (optional) a language locale
@param string $extendedLinkRole (optional)
@return bool|string A description string or false | [
"Returns",
"a",
"description",
"for",
"an",
"element",
"identified",
"by",
"href",
"and",
"optionally",
"a",
"role",
"and",
"language",
"If",
"a",
"label",
"cannot",
"be",
"found",
"using",
"the",
"options",
"and",
"the",
"options",
"are",
"not",
"already",
... | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L4231-L4253 | train |
bseddon/XBRL | XBRL.php | XBRL.getEssenceAliasList | public function getEssenceAliasList()
{
// return $this->context->essenceAlias;
$arcs = $this->context->essenceAlias;
// Remove any prohibited arcs
if ( $arcs && count( $arcs ) )
{
foreach ( $arcs as $from => $targets )
{
foreach ( $targets as $to => $node )
{
if ( $node['use'] == XBRL_Constants::$xlinkUseOptional ) continue;
unset( $arcs[ $from ][ $to ] );
}
if ( count( $arcs[ $from ] ) ) continue;
unset( $arcs[ $from ] );
}
}
return $arcs;
} | php | public function getEssenceAliasList()
{
// return $this->context->essenceAlias;
$arcs = $this->context->essenceAlias;
// Remove any prohibited arcs
if ( $arcs && count( $arcs ) )
{
foreach ( $arcs as $from => $targets )
{
foreach ( $targets as $to => $node )
{
if ( $node['use'] == XBRL_Constants::$xlinkUseOptional ) continue;
unset( $arcs[ $from ][ $to ] );
}
if ( count( $arcs[ $from ] ) ) continue;
unset( $arcs[ $from ] );
}
}
return $arcs;
} | [
"public",
"function",
"getEssenceAliasList",
"(",
")",
"{",
"// return $this->context->essenceAlias;\r",
"$",
"arcs",
"=",
"$",
"this",
"->",
"context",
"->",
"essenceAlias",
";",
"// Remove any prohibited arcs\r",
"if",
"(",
"$",
"arcs",
"&&",
"count",
"(",
"$",
... | Get the essenceAlias array | [
"Get",
"the",
"essenceAlias",
"array"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L4600-L4622 | train |
bseddon/XBRL | XBRL.php | XBRL.& | public function &getCalculationRoleRefs( $filter = array(), $sort = true )
{
// Make sure the filter is initialized and contains lowercase values
if ( ! is_array( $filter ) ) $filter = array();
$filter = array_flip( array_map( 'strtolower', $filter ) );
$refs = $this->context->calculationRoleRefs;
/**
* @var array $result
*/
$result = array();
foreach ( $refs as $refKey => $ref )
{
// Apply the filter if one is provided
if ( count( $filter ) && ! isset( $filter[ strtolower( $refKey ) ] ) ) continue;
$result[ $refKey ] = $this->context->calculationRoleRefs[ $refKey ];
$description = $this->getCalculationLinkRoleDescription( $ref );
$result[ $refKey ]['text'] = $description ? $description : "";
// Remove any prohibited arcs
if ( isset( $result[ $refKey ]['calculations'] ) && count( $result[ $refKey ]['calculations'] ) )
{
$arcs =& $result[ $refKey ]['calculations'];
foreach ( $arcs as $from => $targets )
{
foreach ( $targets as $to => $node )
{
if ( $node['use'] == XBRL_Constants::$xlinkUseOptional ) continue;
unset( $arcs[ $from ][ $to ] );
}
if ( count( $arcs[ $from ] ) ) continue;
unset( $arcs[ $from ] );
}
}
}
if ( $sort )
{
$this->sortRoleRefs( $result );
}
return $result;
} | php | public function &getCalculationRoleRefs( $filter = array(), $sort = true )
{
// Make sure the filter is initialized and contains lowercase values
if ( ! is_array( $filter ) ) $filter = array();
$filter = array_flip( array_map( 'strtolower', $filter ) );
$refs = $this->context->calculationRoleRefs;
/**
* @var array $result
*/
$result = array();
foreach ( $refs as $refKey => $ref )
{
// Apply the filter if one is provided
if ( count( $filter ) && ! isset( $filter[ strtolower( $refKey ) ] ) ) continue;
$result[ $refKey ] = $this->context->calculationRoleRefs[ $refKey ];
$description = $this->getCalculationLinkRoleDescription( $ref );
$result[ $refKey ]['text'] = $description ? $description : "";
// Remove any prohibited arcs
if ( isset( $result[ $refKey ]['calculations'] ) && count( $result[ $refKey ]['calculations'] ) )
{
$arcs =& $result[ $refKey ]['calculations'];
foreach ( $arcs as $from => $targets )
{
foreach ( $targets as $to => $node )
{
if ( $node['use'] == XBRL_Constants::$xlinkUseOptional ) continue;
unset( $arcs[ $from ][ $to ] );
}
if ( count( $arcs[ $from ] ) ) continue;
unset( $arcs[ $from ] );
}
}
}
if ( $sort )
{
$this->sortRoleRefs( $result );
}
return $result;
} | [
"public",
"function",
"&",
"getCalculationRoleRefs",
"(",
"$",
"filter",
"=",
"array",
"(",
")",
",",
"$",
"sort",
"=",
"true",
")",
"{",
"// Make sure the filter is initialized and contains lowercase values\r",
"if",
"(",
"!",
"is_array",
"(",
"$",
"filter",
")",... | Get the calculation links array for a role after adjusting for order and probibition
@param array|string $filter A list of the roles to include in the result. If no filter is specified all roles are returned.
@param bool $sort True if the result list should be sorted
@return array | [
"Get",
"the",
"calculation",
"links",
"array",
"for",
"a",
"role",
"after",
"adjusting",
"for",
"order",
"and",
"probibition"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L4630-L4677 | train |
bseddon/XBRL | XBRL.php | XBRL.& | public function &getNonDimensionalRoleRefs( $filter = array(), $sort = true )
{
// Make sure the filter is initialized and contains lowercase values
if ( ! is_array( $filter ) ) $filter = array();
$filter = array_flip( array_map( 'strtolower', $filter ) );
$refs = $this->context->nonDimensionalRoleRefs;
/**
* @var array $result
*/
$result = array();
foreach ( $refs as $refKey => $ref )
{
// Apply the filter if one is provided
if ( count( $filter ) && ! isset( $filter[ strtolower( $refKey ) ] ) ) continue;
$result[ $refKey ] = $this->context->nonDimensionalRoleRefs[ $refKey ];
foreach ( $result[ $refKey ] as $arcroleKey => $arcrole )
{
// If the acrole type is defined, get the cycles allowed otherwise set it to be 'none'
$arcRoleTaxonomy = $this->getTaxonomyForXSD( $arcrole['href'] );
$arcRoleRefs = $arcRoleTaxonomy ? $arcRoleTaxonomy->getArcroleTypes() : false;
if ( $arcRoleRefs && isset( $arcRoleRefs['link:definitionArc'][ $arcroleKey ] ) )
{
$arcRoleRef = $arcRoleRefs['link:definitionArc'][ $arcroleKey ];
$result[ $refKey ][ $arcroleKey ]['text'] = isset( $arcRoleRef['description'] ) ? $arcRoleRef['description'] : "";
$result[ $refKey ][ $arcroleKey ]['cyclesAllowed'] = isset( $arcRoleRef['cyclesAllowed'] ) ? $arcRoleRef['cyclesAllowed'] : "none";
}
else
{
$result[ $refKey ][ $arcroleKey ]['text'] = "";
$result[ $refKey ][ $arcroleKey ]['cyclesAllowed'] = "none";
}
// Add the description
$description = $arcRoleTaxonomy->getNonDimensionalArcRoleDescription( $arcroleKey );
$result[ $refKey ][ $arcroleKey ]['text'] = $description ? $description : "";
// Remove any prohibited arcs
if ( isset( $result[ $refKey ][ $arcroleKey ]['arcs'] ) && count( $result[ $refKey ][ $arcroleKey ]['arcs'] ) )
{
$arcs =& $result[ $refKey ][ $arcroleKey ]['arcs'];
foreach ( $arcs as $from => $targets )
{
foreach ( $targets as $to => $node )
{
if ( $node['use'] == XBRL_Constants::$xlinkUseOptional ) continue;
unset( $arcs[ $from ][ $to ] );
}
if ( count( $arcs[ $from ] ) ) continue;
unset( $arcs[ $from ] );
}
}
}
if ( $sort )
{
$this->sortRoleRefs( $result[ $refKey ] );
}
}
return $result;
} | php | public function &getNonDimensionalRoleRefs( $filter = array(), $sort = true )
{
// Make sure the filter is initialized and contains lowercase values
if ( ! is_array( $filter ) ) $filter = array();
$filter = array_flip( array_map( 'strtolower', $filter ) );
$refs = $this->context->nonDimensionalRoleRefs;
/**
* @var array $result
*/
$result = array();
foreach ( $refs as $refKey => $ref )
{
// Apply the filter if one is provided
if ( count( $filter ) && ! isset( $filter[ strtolower( $refKey ) ] ) ) continue;
$result[ $refKey ] = $this->context->nonDimensionalRoleRefs[ $refKey ];
foreach ( $result[ $refKey ] as $arcroleKey => $arcrole )
{
// If the acrole type is defined, get the cycles allowed otherwise set it to be 'none'
$arcRoleTaxonomy = $this->getTaxonomyForXSD( $arcrole['href'] );
$arcRoleRefs = $arcRoleTaxonomy ? $arcRoleTaxonomy->getArcroleTypes() : false;
if ( $arcRoleRefs && isset( $arcRoleRefs['link:definitionArc'][ $arcroleKey ] ) )
{
$arcRoleRef = $arcRoleRefs['link:definitionArc'][ $arcroleKey ];
$result[ $refKey ][ $arcroleKey ]['text'] = isset( $arcRoleRef['description'] ) ? $arcRoleRef['description'] : "";
$result[ $refKey ][ $arcroleKey ]['cyclesAllowed'] = isset( $arcRoleRef['cyclesAllowed'] ) ? $arcRoleRef['cyclesAllowed'] : "none";
}
else
{
$result[ $refKey ][ $arcroleKey ]['text'] = "";
$result[ $refKey ][ $arcroleKey ]['cyclesAllowed'] = "none";
}
// Add the description
$description = $arcRoleTaxonomy->getNonDimensionalArcRoleDescription( $arcroleKey );
$result[ $refKey ][ $arcroleKey ]['text'] = $description ? $description : "";
// Remove any prohibited arcs
if ( isset( $result[ $refKey ][ $arcroleKey ]['arcs'] ) && count( $result[ $refKey ][ $arcroleKey ]['arcs'] ) )
{
$arcs =& $result[ $refKey ][ $arcroleKey ]['arcs'];
foreach ( $arcs as $from => $targets )
{
foreach ( $targets as $to => $node )
{
if ( $node['use'] == XBRL_Constants::$xlinkUseOptional ) continue;
unset( $arcs[ $from ][ $to ] );
}
if ( count( $arcs[ $from ] ) ) continue;
unset( $arcs[ $from ] );
}
}
}
if ( $sort )
{
$this->sortRoleRefs( $result[ $refKey ] );
}
}
return $result;
} | [
"public",
"function",
"&",
"getNonDimensionalRoleRefs",
"(",
"$",
"filter",
"=",
"array",
"(",
")",
",",
"$",
"sort",
"=",
"true",
")",
"{",
"// Make sure the filter is initialized and contains lowercase values\r",
"if",
"(",
"!",
"is_array",
"(",
"$",
"filter",
"... | Get the General special links array for a role
@param array|string $filter A list of the roles to include in the result. If no filter is specified all roles are returned.
@param bool $sort True if the result list should be sorted
@return array | [
"Get",
"the",
"General",
"special",
"links",
"array",
"for",
"a",
"role"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L4906-L4972 | train |
bseddon/XBRL | XBRL.php | XBRL.rebuildLabelsByHRef | public function rebuildLabelsByHRef()
{
$labels =& $this->context->labels[ XBRL_Constants::$defaultLinkRole ];
$locators =& $labels['locators'];
if ( isset( $labels['arcs'] ) )
{
$reverseArcs = array();
foreach ( $labels['arcs'] as $from => $to )
{
foreach ( $to as $labelLabel => $items )
{
$reverseArcs[ $labelLabel ] = $from;
}
}
if ( isset( $labels['labels'] ) )
{
$labelsByHref = array();
foreach ( $labels['labels'] as $roleKey => $languageLabels )
{
foreach ( $languageLabels as $lang => $langLabels )
{
foreach ( $langLabels as $labelLabel => $items )
{
if ( ! isset( $items['id'] ) ) continue;
// Lookup the label in the arcs array
if ( ! isset( $reverseArcs[ $labelLabel ] ) )
{
$this->log()->warning( "Ooops. Label $labelLabel not found in the arcs array" );
continue;
}
$label = $reverseArcs[ $labelLabel ];
/*
if ( ! isset( $locators[ $label ] ) )
{
$this->log()->warning( "Ooops. Label $label not found in the locators array" );
continue;
}
$parts = explode( '#', $locators[ $label ] );
*/
$parts = explode( '#', $label );
if ( ! isset( $labelsByHref[ $parts[0] ] ) )
{
$labelsByHref[ $parts[0] ] = array();
}
$labelsByHref[ $parts[0] ][ $items['id'] ][] = array(
'role' => $roleKey,
'label' => $labelLabel,
'lang' => $lang,
);
}
}
}
$labels['labelshref'] = $labelsByHref;
unset( $labelsByHref );
}
unset( $reverseArcs );
}
unset( $locators );
unset( $labels );
} | php | public function rebuildLabelsByHRef()
{
$labels =& $this->context->labels[ XBRL_Constants::$defaultLinkRole ];
$locators =& $labels['locators'];
if ( isset( $labels['arcs'] ) )
{
$reverseArcs = array();
foreach ( $labels['arcs'] as $from => $to )
{
foreach ( $to as $labelLabel => $items )
{
$reverseArcs[ $labelLabel ] = $from;
}
}
if ( isset( $labels['labels'] ) )
{
$labelsByHref = array();
foreach ( $labels['labels'] as $roleKey => $languageLabels )
{
foreach ( $languageLabels as $lang => $langLabels )
{
foreach ( $langLabels as $labelLabel => $items )
{
if ( ! isset( $items['id'] ) ) continue;
// Lookup the label in the arcs array
if ( ! isset( $reverseArcs[ $labelLabel ] ) )
{
$this->log()->warning( "Ooops. Label $labelLabel not found in the arcs array" );
continue;
}
$label = $reverseArcs[ $labelLabel ];
/*
if ( ! isset( $locators[ $label ] ) )
{
$this->log()->warning( "Ooops. Label $label not found in the locators array" );
continue;
}
$parts = explode( '#', $locators[ $label ] );
*/
$parts = explode( '#', $label );
if ( ! isset( $labelsByHref[ $parts[0] ] ) )
{
$labelsByHref[ $parts[0] ] = array();
}
$labelsByHref[ $parts[0] ][ $items['id'] ][] = array(
'role' => $roleKey,
'label' => $labelLabel,
'lang' => $lang,
);
}
}
}
$labels['labelshref'] = $labelsByHref;
unset( $labelsByHref );
}
unset( $reverseArcs );
}
unset( $locators );
unset( $labels );
} | [
"public",
"function",
"rebuildLabelsByHRef",
"(",
")",
"{",
"$",
"labels",
"=",
"&",
"$",
"this",
"->",
"context",
"->",
"labels",
"[",
"XBRL_Constants",
"::",
"$",
"defaultLinkRole",
"]",
";",
"$",
"locators",
"=",
"&",
"$",
"labels",
"[",
"'locators'",
... | Used by extension taxonomy processing to rebuild an index array. | [
"Used",
"by",
"extension",
"taxonomy",
"processing",
"to",
"rebuild",
"an",
"index",
"array",
"."
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L4985-L5057 | train |
bseddon/XBRL | XBRL.php | XBRL.processCustomLinkbases | private function processCustomLinkbases( &$linkbaseType )
{
// $this->log()->info( "Process definition linkbases: " . $this->namespace );
foreach ( $linkbaseType as $linkbaseRefkey => &$linkbaseRef )
{
$this->processCustomLinkbaseArcRoles( $linkbaseRef );
$linkbaseRef['processed'] = true;
}
} | php | private function processCustomLinkbases( &$linkbaseType )
{
// $this->log()->info( "Process definition linkbases: " . $this->namespace );
foreach ( $linkbaseType as $linkbaseRefkey => &$linkbaseRef )
{
$this->processCustomLinkbaseArcRoles( $linkbaseRef );
$linkbaseRef['processed'] = true;
}
} | [
"private",
"function",
"processCustomLinkbases",
"(",
"&",
"$",
"linkbaseType",
")",
"{",
"// $this->log()->info( \"Process definition linkbases: \" . $this->namespace );\r",
"foreach",
"(",
"$",
"linkbaseType",
"as",
"$",
"linkbaseRefkey",
"=>",
"&",
"$",
"linkbaseRef",
")... | Process the calculation linkbase type.
@param array $linkbaseType (by reference) The link base type to process
@return void | [
"Process",
"the",
"calculation",
"linkbase",
"type",
"."
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L5612-L5620 | train |
bseddon/XBRL | XBRL.php | XBRL.normalizePrefix | private function normalizePrefix( $inputQName, $taxonomy )
{
if ( empty( $inputQName ) )
{
return $inputQName;
}
$qname = $inputQName instanceof QName
? $inputQName
: qname( $inputQName, $this->getDocumentNamespaces() );
if ( is_null( $qname ) ) return $inputQName;
$namespaceTaxonomy = $taxonomy->getTaxonomyForNamespace( $qname->namespaceURI );
if ( $namespaceTaxonomy )
{
// There is so normalize the prefix
return "{$namespaceTaxonomy->getPrefix()}:{$qname->localName}";
}
return ! is_null( $qname ) && isset( XBRL_Constants::$standardNamespaces[ $qname->namespaceURI ] )
? XBRL_Constants::$standardNamespaces[ $qname->namespaceURI ] . ":" . $qname->localName
: $inputQName;
} | php | private function normalizePrefix( $inputQName, $taxonomy )
{
if ( empty( $inputQName ) )
{
return $inputQName;
}
$qname = $inputQName instanceof QName
? $inputQName
: qname( $inputQName, $this->getDocumentNamespaces() );
if ( is_null( $qname ) ) return $inputQName;
$namespaceTaxonomy = $taxonomy->getTaxonomyForNamespace( $qname->namespaceURI );
if ( $namespaceTaxonomy )
{
// There is so normalize the prefix
return "{$namespaceTaxonomy->getPrefix()}:{$qname->localName}";
}
return ! is_null( $qname ) && isset( XBRL_Constants::$standardNamespaces[ $qname->namespaceURI ] )
? XBRL_Constants::$standardNamespaces[ $qname->namespaceURI ] . ":" . $qname->localName
: $inputQName;
} | [
"private",
"function",
"normalizePrefix",
"(",
"$",
"inputQName",
",",
"$",
"taxonomy",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"inputQName",
")",
")",
"{",
"return",
"$",
"inputQName",
";",
"}",
"$",
"qname",
"=",
"$",
"inputQName",
"instanceof",
"QName... | Standardize on the prefix used by the original schema not the name used by the dependent schema.
For example, the generics schema used the prefix 'gen' but a dependent schema might use the
prefix 'generic' or 'gene' or something else entirely.
@param string $inputQName
@param XBRL $taxonomy
@return string | [
"Standardize",
"on",
"the",
"prefix",
"used",
"by",
"the",
"original",
"schema",
"not",
"the",
"name",
"used",
"by",
"the",
"dependent",
"schema",
".",
"For",
"example",
"the",
"generics",
"schema",
"used",
"the",
"prefix",
"gen",
"but",
"a",
"dependent",
... | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L5630-L5652 | train |
bseddon/XBRL | XBRL.php | XBRL.normalizeUsedOn | private function normalizeUsedOn( &$ts, &$taxonomy )
{
foreach ( $ts as $usedOn => $arcroles )
{
if ( isset( \XBRL_Constants::$standardArcRoles[ $usedOn ] ) ||
\XBRL_Constants::isStandardExtLinkQname( qname( $usedOn, array( 'link' => \XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_LINK] ) ) )
)
{
// Nothing to do
continue;
}
else
{
// Standardize on the prefix used by the original schema not the name used by the dependent schema.
// For example, the generics schema used the prefix 'gen' but a dependent schema might use the
// prefix 'generic' or 'gene' or something else entirely.
/**
* @var QName $usedOnQName
*/
$usedOnQName = qname( $usedOn, $taxonomy->getDocumentNamespaces() );
// Is there a taxonomy for this namespace?
$usedOnTaxonomy = $taxonomy->getTaxonomyForNamespace( $usedOnQName->namespaceURI );
if ( $usedOnTaxonomy )
{
// There is so normalize the prefix
$usedOn2 = "{$usedOnTaxonomy->getPrefix()}:{$usedOnQName->localName}";
// If the prefix was already correct there is nothing to do
if ( $usedOn == $usedOn2 )
{
continue;
}
$ts[ $usedOn2 ] = $arcroles;
unset( $ts[ $usedOn ] );
}
}
}
} | php | private function normalizeUsedOn( &$ts, &$taxonomy )
{
foreach ( $ts as $usedOn => $arcroles )
{
if ( isset( \XBRL_Constants::$standardArcRoles[ $usedOn ] ) ||
\XBRL_Constants::isStandardExtLinkQname( qname( $usedOn, array( 'link' => \XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_LINK] ) ) )
)
{
// Nothing to do
continue;
}
else
{
// Standardize on the prefix used by the original schema not the name used by the dependent schema.
// For example, the generics schema used the prefix 'gen' but a dependent schema might use the
// prefix 'generic' or 'gene' or something else entirely.
/**
* @var QName $usedOnQName
*/
$usedOnQName = qname( $usedOn, $taxonomy->getDocumentNamespaces() );
// Is there a taxonomy for this namespace?
$usedOnTaxonomy = $taxonomy->getTaxonomyForNamespace( $usedOnQName->namespaceURI );
if ( $usedOnTaxonomy )
{
// There is so normalize the prefix
$usedOn2 = "{$usedOnTaxonomy->getPrefix()}:{$usedOnQName->localName}";
// If the prefix was already correct there is nothing to do
if ( $usedOn == $usedOn2 )
{
continue;
}
$ts[ $usedOn2 ] = $arcroles;
unset( $ts[ $usedOn ] );
}
}
}
} | [
"private",
"function",
"normalizeUsedOn",
"(",
"&",
"$",
"ts",
",",
"&",
"$",
"taxonomy",
")",
"{",
"foreach",
"(",
"$",
"ts",
"as",
"$",
"usedOn",
"=>",
"$",
"arcroles",
")",
"{",
"if",
"(",
"isset",
"(",
"\\",
"XBRL_Constants",
"::",
"$",
"standard... | Converts the types usedon qname to use the prefix of the original taxonomy
@param array $ts
@param XBRL $taxonomy
@return void | [
"Converts",
"the",
"types",
"usedon",
"qname",
"to",
"use",
"the",
"prefix",
"of",
"the",
"original",
"taxonomy"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L5661-L5698 | train |
bseddon/XBRL | XBRL.php | XBRL.getAllLinkbaseRoleTypes | public function getAllLinkbaseRoleTypes()
{
// Gather all role types
return array_reduce( $this->context->importedSchemas, function( $carry, /** @var XBRL $taxonomy */ &$taxonomy )
{
$lrts = $taxonomy->getLinkbaseRoleTypes();
foreach ( $lrts as $linkbase => $definition )
{
if ( isset( $carry[ $linkbase ] ) )
{
$carry = array_merge( $carry[ $linkbase ], $definition );
}
else
{
$carry[ $linkbase ] = $definition;
}
}
return $carry;
}, array() );
} | php | public function getAllLinkbaseRoleTypes()
{
// Gather all role types
return array_reduce( $this->context->importedSchemas, function( $carry, /** @var XBRL $taxonomy */ &$taxonomy )
{
$lrts = $taxonomy->getLinkbaseRoleTypes();
foreach ( $lrts as $linkbase => $definition )
{
if ( isset( $carry[ $linkbase ] ) )
{
$carry = array_merge( $carry[ $linkbase ], $definition );
}
else
{
$carry[ $linkbase ] = $definition;
}
}
return $carry;
}, array() );
} | [
"public",
"function",
"getAllLinkbaseRoleTypes",
"(",
")",
"{",
"// Gather all role types\r",
"return",
"array_reduce",
"(",
"$",
"this",
"->",
"context",
"->",
"importedSchemas",
",",
"function",
"(",
"$",
"carry",
",",
"/** @var XBRL $taxonomy */",
"&",
"$",
"taxo... | Retrieve an array of linkbase role types across all taxonomies
@return array | [
"Retrieve",
"an",
"array",
"of",
"linkbase",
"role",
"types",
"across",
"all",
"taxonomies"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L5772-L5794 | train |
bseddon/XBRL | XBRL.php | XBRL.getAllRoleTypes | public function getAllRoleTypes()
{
// Gather all role types
return array_reduce( $this->context->importedSchemas, function( $carry, /** @var XBRL $taxonomy */ &$taxonomy )
{
$rts = $taxonomy->getRoleTypes();
$taxonomy->normalizeUsedOn( $rts, $taxonomy );
if ( count( $carry ) )
{
foreach ( $rts as $usedOn => $roles )
{
if ( isset( $carry[ $usedOn ] ) )
{
foreach ( $roles as $role => $details )
{
if ( ! isset( $carry[ $usedOn ][ $role ] ) )
{
$carry[ $usedOn ][ $role ] = $details;
}
}
}
else
{
$carry[ $usedOn ] = $roles;
}
}
}
else
{
$carry = $rts;
}
return $carry;
}, array() );
} | php | public function getAllRoleTypes()
{
// Gather all role types
return array_reduce( $this->context->importedSchemas, function( $carry, /** @var XBRL $taxonomy */ &$taxonomy )
{
$rts = $taxonomy->getRoleTypes();
$taxonomy->normalizeUsedOn( $rts, $taxonomy );
if ( count( $carry ) )
{
foreach ( $rts as $usedOn => $roles )
{
if ( isset( $carry[ $usedOn ] ) )
{
foreach ( $roles as $role => $details )
{
if ( ! isset( $carry[ $usedOn ][ $role ] ) )
{
$carry[ $usedOn ][ $role ] = $details;
}
}
}
else
{
$carry[ $usedOn ] = $roles;
}
}
}
else
{
$carry = $rts;
}
return $carry;
}, array() );
} | [
"public",
"function",
"getAllRoleTypes",
"(",
")",
"{",
"// Gather all role types\r",
"return",
"array_reduce",
"(",
"$",
"this",
"->",
"context",
"->",
"importedSchemas",
",",
"function",
"(",
"$",
"carry",
",",
"/** @var XBRL $taxonomy */",
"&",
"$",
"taxonomy",
... | Retrieve an array of role types across all taxonomies
@return array | [
"Retrieve",
"an",
"array",
"of",
"role",
"types",
"across",
"all",
"taxonomies"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L5801-L5835 | train |
bseddon/XBRL | XBRL.php | XBRL.getGenericLabel | public function getGenericLabel( $searchRole, $searchLabel = null, $searchLang = null, $linkPath = null )
{
if ( ! isset( $this->genericRoles['roles'] ) ) return false;
$results = array();
if ( ! isset( $this->genericRoles['roles'][ $searchRole ]['labels'] ) ) return $results;
foreach ( $this->genericRoles['roles'][ $searchRole ]['labels'] as $linkbase => $labels )
{
foreach ( $labels as $label => $langs )
{
if ( ! is_null( $searchLabel ) && $label != $searchLabel ) continue;
foreach ( $langs['lang'] as $lang => $text )
{
if ( ! is_null( $searchLang ) && $lang != $searchLang ) continue;
$results[ $label ] = array(
'linkbase' => $linkbase,
'label' => $label,
'lang' => $lang,
'text' => isset( $text[ $linkPath ] ) ? $text[ $linkPath] : reset( $text ),
);
}
if ( ! is_null( $searchLabel ) )
{
return $results;
}
}
}
return $results;
} | php | public function getGenericLabel( $searchRole, $searchLabel = null, $searchLang = null, $linkPath = null )
{
if ( ! isset( $this->genericRoles['roles'] ) ) return false;
$results = array();
if ( ! isset( $this->genericRoles['roles'][ $searchRole ]['labels'] ) ) return $results;
foreach ( $this->genericRoles['roles'][ $searchRole ]['labels'] as $linkbase => $labels )
{
foreach ( $labels as $label => $langs )
{
if ( ! is_null( $searchLabel ) && $label != $searchLabel ) continue;
foreach ( $langs['lang'] as $lang => $text )
{
if ( ! is_null( $searchLang ) && $lang != $searchLang ) continue;
$results[ $label ] = array(
'linkbase' => $linkbase,
'label' => $label,
'lang' => $lang,
'text' => isset( $text[ $linkPath ] ) ? $text[ $linkPath] : reset( $text ),
);
}
if ( ! is_null( $searchLabel ) )
{
return $results;
}
}
}
return $results;
} | [
"public",
"function",
"getGenericLabel",
"(",
"$",
"searchRole",
",",
"$",
"searchLabel",
"=",
"null",
",",
"$",
"searchLang",
"=",
"null",
",",
"$",
"linkPath",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"genericRoles",
"[... | Get the generic label resource for the give role, label and language
@param string $searchRole
@param string $searchLabel
@param string $searchLang
@param string $linkPath
@return boolean|unknown[][]|mixed[][] | [
"Get",
"the",
"generic",
"label",
"resource",
"for",
"the",
"give",
"role",
"label",
"and",
"language"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L6203-L6237 | train |
bseddon/XBRL | XBRL.php | XBRL.updateGenericResource | public function updateGenericResource( $roleUri, $linkbase, $resourceName, $index, $resource )
{
$this->genericRoles['roles']
[ $roleUri ]
['resources']
[ $linkbase ]
[ $resourceName ]
[ $index ] = $resource;
} | php | public function updateGenericResource( $roleUri, $linkbase, $resourceName, $index, $resource )
{
$this->genericRoles['roles']
[ $roleUri ]
['resources']
[ $linkbase ]
[ $resourceName ]
[ $index ] = $resource;
} | [
"public",
"function",
"updateGenericResource",
"(",
"$",
"roleUri",
",",
"$",
"linkbase",
",",
"$",
"resourceName",
",",
"$",
"index",
",",
"$",
"resource",
")",
"{",
"$",
"this",
"->",
"genericRoles",
"[",
"'roles'",
"]",
"[",
"$",
"roleUri",
"]",
"[",
... | Update a specific indexed generic resource
Mainly used to update formulas filter
@param string $roleUri
@param string $linkbase
@param string $resourceName
@param int $index
@param array $resource | [
"Update",
"a",
"specific",
"indexed",
"generic",
"resource",
"Mainly",
"used",
"to",
"update",
"formulas",
"filter"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L6321-L6329 | train |
bseddon/XBRL | XBRL.php | XBRL.getGenericArc | public function getGenericArc( $arcRole, $fromRoleUri, $fromResourceName = null, $fromPath = null, $arcLinkbase = null, $fromLinkbase = null, $toLinkbase = null )
{
if ( ! isset( $this->genericRoles['roles'] ) ) return false;
$results = array();
foreach ( $this->genericRoles['roles'] as $roleUri => $role )
{
if ( ! isset( $role['arcroles'] ) || ! isset( $role['arcroles'][ $arcRole ] ) ) continue;
foreach ( $role['arcroles'][ $arcRole ]['links'] as $linkName => $arcElements )
{
foreach ( $arcElements['arcelements'] as $arcName => $arcs )
{
foreach ( $arcs['arcs'] as $fromLabel => $tos )
{
if ( ! is_null( $fromResourceName ) && $fromLabel != $fromResourceName ) continue;
foreach ( $tos as $toLabel => $to )
{
foreach ( $to as $arc )
{
if ( $arc['fromRoleUri'] != $fromRoleUri ) continue;
if ( ! is_null( $fromPath ) && $fromPath != $arc['frompath'] ) continue;
if ( ! is_null( $arcLinkbase ) && $arcLinkbase != $arc['linkbase'] ) continue;
if ( ! is_null( $fromLinkbase ) && $fromLinkbase != $arc['fromlinkbase'] ) continue;
if ( ! is_null( $toLinkbase ) && $toLinkbase != $arc['tolinkbase'] ) continue;
$results[] = $arc;
}
}
}
}
}
}
return $results;
} | php | public function getGenericArc( $arcRole, $fromRoleUri, $fromResourceName = null, $fromPath = null, $arcLinkbase = null, $fromLinkbase = null, $toLinkbase = null )
{
if ( ! isset( $this->genericRoles['roles'] ) ) return false;
$results = array();
foreach ( $this->genericRoles['roles'] as $roleUri => $role )
{
if ( ! isset( $role['arcroles'] ) || ! isset( $role['arcroles'][ $arcRole ] ) ) continue;
foreach ( $role['arcroles'][ $arcRole ]['links'] as $linkName => $arcElements )
{
foreach ( $arcElements['arcelements'] as $arcName => $arcs )
{
foreach ( $arcs['arcs'] as $fromLabel => $tos )
{
if ( ! is_null( $fromResourceName ) && $fromLabel != $fromResourceName ) continue;
foreach ( $tos as $toLabel => $to )
{
foreach ( $to as $arc )
{
if ( $arc['fromRoleUri'] != $fromRoleUri ) continue;
if ( ! is_null( $fromPath ) && $fromPath != $arc['frompath'] ) continue;
if ( ! is_null( $arcLinkbase ) && $arcLinkbase != $arc['linkbase'] ) continue;
if ( ! is_null( $fromLinkbase ) && $fromLinkbase != $arc['fromlinkbase'] ) continue;
if ( ! is_null( $toLinkbase ) && $toLinkbase != $arc['tolinkbase'] ) continue;
$results[] = $arc;
}
}
}
}
}
}
return $results;
} | [
"public",
"function",
"getGenericArc",
"(",
"$",
"arcRole",
",",
"$",
"fromRoleUri",
",",
"$",
"fromResourceName",
"=",
"null",
",",
"$",
"fromPath",
"=",
"null",
",",
"$",
"arcLinkbase",
"=",
"null",
",",
"$",
"fromLinkbase",
"=",
"null",
",",
"$",
"toL... | Get an arc for an arcrole and an optional resource. If the label of a source resource
is not supplied all resources associated with an arc role are returned
@param string $arcRole
@param string $fromRoleUri
@param string $fromResourceName (optional) The name (label) of the source of the arc
@param string $fromPath (optional) The path of source of the arc to be filtered
@param string $arcLinkbase (optional) The linkbase of the arc definition
@param string $fromLinkbase (optional) The linkbase of the source of the arc to be filtered
@param string $toLinkbase (optional) The linkbase of the target of the arc to be filtered
@return array | [
"Get",
"an",
"arc",
"for",
"an",
"arcrole",
"and",
"an",
"optional",
"resource",
".",
"If",
"the",
"label",
"of",
"a",
"source",
"resource",
"is",
"not",
"supplied",
"all",
"resources",
"associated",
"with",
"an",
"arc",
"role",
"are",
"returned"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L6343-L6379 | train |
bseddon/XBRL | XBRL.php | XBRL.processNonDimensionalLink | private function processNonDimensionalLink( &$link, $linkbase, $role, &$standardRoles, &$arcroleRefs, $href, $xml_basename, $arcName = 'definitionArc', $arcTitle = 'Definition' )
{
// Detection of duplicate from/to pairs only applies within an extended link so reset this varaible in each new link
$this->resetValidateFromToArcPairs();
// Get a list of the locators for this extended link
$locators = $this->retrieveLocators( $link, $linkbase, $href );
if ( ! count( $locators ) ) return;
// Used to catch duplicated from/to label pairs which is not alloed by the XLink specification
$fromToPairs = array();
foreach ( $link->children( XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_LINK ] )->$arcName as $arcKey => $arc )
{
$xlinkAttributes = $arc->attributes( XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_XLINK ] );
$attributes = $arc->attributes();
if ( ! $this->validateXLinkArcAttributes( $xlinkAttributes, $linkbase ) )
{
continue;
}
if ( isset( $fromToPairs[ (string)$xlinkAttributes->from ][ (string)$xlinkAttributes->to ] ) )
{
$this->log()->taxonomy_validation( "XLink", "$arcTitle arcs contain repeated from/to label pairs in the same extended link",
array(
'role' => $role,
'from' => (string)$xlinkAttributes->from,
'to' => (string)$xlinkAttributes->to
)
);
}
else
{
$fromToPairs[ (string)$xlinkAttributes->from ][ (string)$xlinkAttributes->to ] = 1;
}
$this->processNonDimensionalArc( $arc, $locators, $linkbase, $role, $xlinkAttributes, $attributes, $standardRoles, $arcroleRefs, $xml_basename, $arcTitle );
}
} | php | private function processNonDimensionalLink( &$link, $linkbase, $role, &$standardRoles, &$arcroleRefs, $href, $xml_basename, $arcName = 'definitionArc', $arcTitle = 'Definition' )
{
// Detection of duplicate from/to pairs only applies within an extended link so reset this varaible in each new link
$this->resetValidateFromToArcPairs();
// Get a list of the locators for this extended link
$locators = $this->retrieveLocators( $link, $linkbase, $href );
if ( ! count( $locators ) ) return;
// Used to catch duplicated from/to label pairs which is not alloed by the XLink specification
$fromToPairs = array();
foreach ( $link->children( XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_LINK ] )->$arcName as $arcKey => $arc )
{
$xlinkAttributes = $arc->attributes( XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_XLINK ] );
$attributes = $arc->attributes();
if ( ! $this->validateXLinkArcAttributes( $xlinkAttributes, $linkbase ) )
{
continue;
}
if ( isset( $fromToPairs[ (string)$xlinkAttributes->from ][ (string)$xlinkAttributes->to ] ) )
{
$this->log()->taxonomy_validation( "XLink", "$arcTitle arcs contain repeated from/to label pairs in the same extended link",
array(
'role' => $role,
'from' => (string)$xlinkAttributes->from,
'to' => (string)$xlinkAttributes->to
)
);
}
else
{
$fromToPairs[ (string)$xlinkAttributes->from ][ (string)$xlinkAttributes->to ] = 1;
}
$this->processNonDimensionalArc( $arc, $locators, $linkbase, $role, $xlinkAttributes, $attributes, $standardRoles, $arcroleRefs, $xml_basename, $arcTitle );
}
} | [
"private",
"function",
"processNonDimensionalLink",
"(",
"&",
"$",
"link",
",",
"$",
"linkbase",
",",
"$",
"role",
",",
"&",
"$",
"standardRoles",
",",
"&",
"$",
"arcroleRefs",
",",
"$",
"href",
",",
"$",
"xml_basename",
",",
"$",
"arcName",
"=",
"'defin... | Process a specifc link for essensce-alias and requires-element
@param SimpleXMLElement $link
@param string $linkbase The base name of the link such as 'calculation'
@param string $role
@param array $standardRoles A list of the roles that are valid for this link type
@param array $arcroleRefs
@param string $href The name of the file containing $link
@param string $xml_basename
@param string $arcName
@param string $arcTitle
return void | [
"Process",
"a",
"specifc",
"link",
"for",
"essensce",
"-",
"alias",
"and",
"requires",
"-",
"element"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L8534-L8572 | train |
bseddon/XBRL | XBRL.php | XBRL.getNonExemptArcAttributes | private function getNonExemptArcAttributes( $arc )
{
$arcAttributes = array( 'order' => array( // 3.5.3.9.5 If the order attribute is not defined then it defaults to 1
'name' => 'order',
'type' => 'order',
'namespace' => null,
'prefix' => "",
'value' => 1 )
);
// Use the DOM classes because they expose the node properties and will enumerate all attributes
$domNode = dom_import_simplexml( $arc );
if ( $domNode->hasAttributes() )
{
foreach( $domNode->attributes as $attrKey => $attrNode )
{
// 'use', 'priority' and the xlink attributes are exempted from the arc equivalency tests
if ( in_array( $attrNode->localName, array( 'priority', 'use' ) ) || $attrNode->namespaceURI == XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_XLINK ] ) continue;
$qname = new QName( $attrNode->prefix, $attrNode->namespaceURI, $attrNode->localName );
$arcAttributes[ $qname->clarkNotation() ] = array(
'name' => $attrNode->localName,
'type' => $attrNode->nodeName,
'namespace' => $attrNode->namespaceURI,
'prefix' => $attrNode->prefix,
'value' => $attrNode->nodeValue
);
if ( ! $attrNode->nextSibling ) break;
$attrNode = $attrNode->nextSibling;
}
}
return $arcAttributes;
} | php | private function getNonExemptArcAttributes( $arc )
{
$arcAttributes = array( 'order' => array( // 3.5.3.9.5 If the order attribute is not defined then it defaults to 1
'name' => 'order',
'type' => 'order',
'namespace' => null,
'prefix' => "",
'value' => 1 )
);
// Use the DOM classes because they expose the node properties and will enumerate all attributes
$domNode = dom_import_simplexml( $arc );
if ( $domNode->hasAttributes() )
{
foreach( $domNode->attributes as $attrKey => $attrNode )
{
// 'use', 'priority' and the xlink attributes are exempted from the arc equivalency tests
if ( in_array( $attrNode->localName, array( 'priority', 'use' ) ) || $attrNode->namespaceURI == XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_XLINK ] ) continue;
$qname = new QName( $attrNode->prefix, $attrNode->namespaceURI, $attrNode->localName );
$arcAttributes[ $qname->clarkNotation() ] = array(
'name' => $attrNode->localName,
'type' => $attrNode->nodeName,
'namespace' => $attrNode->namespaceURI,
'prefix' => $attrNode->prefix,
'value' => $attrNode->nodeValue
);
if ( ! $attrNode->nextSibling ) break;
$attrNode = $attrNode->nextSibling;
}
}
return $arcAttributes;
} | [
"private",
"function",
"getNonExemptArcAttributes",
"(",
"$",
"arc",
")",
"{",
"$",
"arcAttributes",
"=",
"array",
"(",
"'order'",
"=>",
"array",
"(",
"// 3.5.3.9.5 If the order attribute is not defined then it defaults to 1\r",
"'name'",
"=>",
"'order'",
",",
"'type'",
... | Create a list of exempt attributes to be used in an arc equivalency test
2018-05-01 At the moment this function is only used on calculation link arcs but needs to be applied to all arc types
@param SimpleXMLElement $arc
@return array | [
"Create",
"a",
"list",
"of",
"exempt",
"attributes",
"to",
"be",
"used",
"in",
"an",
"arc",
"equivalency",
"test",
"2018",
"-",
"05",
"-",
"01",
"At",
"the",
"moment",
"this",
"function",
"is",
"only",
"used",
"on",
"calculation",
"link",
"arcs",
"but",
... | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L9029-L9063 | train |
bseddon/XBRL | XBRL.php | XBRL.arcAttrbutesAreEquivalent | private function arcAttrbutesAreEquivalent( $attributes1, $attributes2 )
{
$array1Keys = array_keys( $attributes1 );
$array2Keys = array_keys( $attributes2 );
// Look for mismatched attributes
if ( array_diff( $array1Keys, $array2Keys ) || array_diff( $array2Keys, $array1Keys ) ) return false;
foreach ( $attributes1 as $type => $attribute )
{
if ( ! isset( $attributes2[ $type ] ) ) return false;
$typePrefix1 = $this->context->types->getPrefixForNamespace( $attribute['namespace'] );
$xequalType1 = XBRL_Equality::xequalAttributeType( $this->context->types, $attribute['name'], $typePrefix1 );
$typePrefix2 = $this->context->types->getPrefixForNamespace( $attributes2[ $type ]['namespace'] );
$xequalType2 = XBRL_Equality::xequalAttributeType( $this->context->types, $attributes2[ $type ]['name'], $typePrefix2 );
if ( ! XBRL_Equality::xequal( $attribute['value'], $attributes2[ $type ]['value'], $xequalType1, $xequalType2 ) )
{
return false;
}
}
return true;
} | php | private function arcAttrbutesAreEquivalent( $attributes1, $attributes2 )
{
$array1Keys = array_keys( $attributes1 );
$array2Keys = array_keys( $attributes2 );
// Look for mismatched attributes
if ( array_diff( $array1Keys, $array2Keys ) || array_diff( $array2Keys, $array1Keys ) ) return false;
foreach ( $attributes1 as $type => $attribute )
{
if ( ! isset( $attributes2[ $type ] ) ) return false;
$typePrefix1 = $this->context->types->getPrefixForNamespace( $attribute['namespace'] );
$xequalType1 = XBRL_Equality::xequalAttributeType( $this->context->types, $attribute['name'], $typePrefix1 );
$typePrefix2 = $this->context->types->getPrefixForNamespace( $attributes2[ $type ]['namespace'] );
$xequalType2 = XBRL_Equality::xequalAttributeType( $this->context->types, $attributes2[ $type ]['name'], $typePrefix2 );
if ( ! XBRL_Equality::xequal( $attribute['value'], $attributes2[ $type ]['value'], $xequalType1, $xequalType2 ) )
{
return false;
}
}
return true;
} | [
"private",
"function",
"arcAttrbutesAreEquivalent",
"(",
"$",
"attributes1",
",",
"$",
"attributes2",
")",
"{",
"$",
"array1Keys",
"=",
"array_keys",
"(",
"$",
"attributes1",
")",
";",
"$",
"array2Keys",
"=",
"array_keys",
"(",
"$",
"attributes2",
")",
";",
... | Tests two arrays for equivalence
2018-05-01 At the moment this function is only used with calculation link arcs but needs to be applied to all arc types
@param array $attributes1 This array will have been generated by a call to getNonExemptArcAttributes
@param array $attributes2 This array will have been generated by a call to getNonExemptArcAttributes
@return bool | [
"Tests",
"two",
"arrays",
"for",
"equivalence",
"2018",
"-",
"05",
"-",
"01",
"At",
"the",
"moment",
"this",
"function",
"is",
"only",
"used",
"with",
"calculation",
"link",
"arcs",
"but",
"needs",
"to",
"be",
"applied",
"to",
"all",
"arc",
"types"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L9072-L9095 | train |
bseddon/XBRL | XBRL.php | XBRL.findTaxonomyElement | private function findTaxonomyElement( $href, $linkbase, &$namespace = null )
{
$taxonomy =& $this;
// BMS 2019-01-26 Don't know why this test is looking at the PHP_URL_PATH as it is unlikely to match
// NOTE: This probably needs changing to test $href against schema location now
// getTaxonomyForXSD works on full paths.
// $xsd = parse_url( $href, PHP_URL_PATH );
$xsd = basename( parse_url( $href, PHP_URL_PATH ) );
if ( $xsd !== $this->getTaxonomyXSD() )
{
// $this->log()->err( "Other taxonomy $href" );
// BMS 2019-01-26 Now full Urls are being used to
$taxonomy = $this->getTaxonomyForXSD( $xsd );
if ( ! $taxonomy )
{
$this->log()->warning( "Taxonomy cannot be found for $href" );
return null;
}
}
// $namespace = $taxonomy->getNamespace();
// Lookup the element
$fragment = parse_url( $href, PHP_URL_FRAGMENT );
$element = $taxonomy->getElementById( $fragment );
if ( $element ) return $element;
// $elements =& $taxonomy->getElements();
// $fragment = parse_url( $href, PHP_URL_FRAGMENT );
// if ( isset( $elements[ $fragment ] ) )
// {
// $element =& $elements[ $fragment ];
// return $element;
// }
$this->log()->warning( "Cannot find an element for linkbase '$linkbase' element '$href'" );
return null;
} | php | private function findTaxonomyElement( $href, $linkbase, &$namespace = null )
{
$taxonomy =& $this;
// BMS 2019-01-26 Don't know why this test is looking at the PHP_URL_PATH as it is unlikely to match
// NOTE: This probably needs changing to test $href against schema location now
// getTaxonomyForXSD works on full paths.
// $xsd = parse_url( $href, PHP_URL_PATH );
$xsd = basename( parse_url( $href, PHP_URL_PATH ) );
if ( $xsd !== $this->getTaxonomyXSD() )
{
// $this->log()->err( "Other taxonomy $href" );
// BMS 2019-01-26 Now full Urls are being used to
$taxonomy = $this->getTaxonomyForXSD( $xsd );
if ( ! $taxonomy )
{
$this->log()->warning( "Taxonomy cannot be found for $href" );
return null;
}
}
// $namespace = $taxonomy->getNamespace();
// Lookup the element
$fragment = parse_url( $href, PHP_URL_FRAGMENT );
$element = $taxonomy->getElementById( $fragment );
if ( $element ) return $element;
// $elements =& $taxonomy->getElements();
// $fragment = parse_url( $href, PHP_URL_FRAGMENT );
// if ( isset( $elements[ $fragment ] ) )
// {
// $element =& $elements[ $fragment ];
// return $element;
// }
$this->log()->warning( "Cannot find an element for linkbase '$linkbase' element '$href'" );
return null;
} | [
"private",
"function",
"findTaxonomyElement",
"(",
"$",
"href",
",",
"$",
"linkbase",
",",
"&",
"$",
"namespace",
"=",
"null",
")",
"{",
"$",
"taxonomy",
"=",
"&",
"$",
"this",
";",
"// BMS 2019-01-26 Don't know why this test is looking at the PHP_URL_PATH as it is un... | Find the taxonomy element for the href. The namespace of the located element is also retrieved.
@param string $href
@param string $linkbase
@param string $namespace
@return NULL|mixed | [
"Find",
"the",
"taxonomy",
"element",
"for",
"the",
"href",
".",
"The",
"namespace",
"of",
"the",
"located",
"element",
"is",
"also",
"retrieved",
"."
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L9438-L9477 | train |
bseddon/XBRL | XBRL.php | XBRL.removeDefinitionArc | public function removeDefinitionArc( $roleUri, $from, $to )
{
if ( ! isset( $this->definitionRoleRefs[ $roleUri ] ) ) return false;
if ( isset( $this->definitionRoleRefs[ $roleUri ]['primaryitems'][ $to ] ) )
{
unset( $this->definitionRoleRefs[ $roleUri ]['primaryitems'][ $to ] );
}
if ( isset( $this->definitionRoleRefs[ $roleUri ]['members'][ $to ] ) )
{
unset( $this->definitionRoleRefs[ $roleUri ]['members'][ $to ] );
}
if ( isset( $this->definitionRoleRefs[ $roleUri ]['dimensions'][ $to ] ) )
{
unset( $this->definitionRoleRefs[ $roleUri ]['dimensions'][ $to ] );
}
// BMS 2017-03-21 Not using the hierarchy any more so the reference to 'paths' is redundant
return;
$toFragment = parse_url( $to, PHP_URL_FRAGMENT );
$fromFragment = parse_url( $from, PHP_URL_FRAGMENT );
if ( isset( $this->definitionRoleRefs[ $roleUri ]['paths'][ $toFragment ] ) )
{
$paths = $this->definitionRoleRefs[ $roleUri ]['paths'][ $toFragment ];
$me = $this;
$this->processNodeByPath( $this->definitionRoleRefs[ $roleUri ]['hierarchy'], $paths, $from,
function( &$node, $path, $parentKey ) use( &$me, $from, $to, $roleUri ) {
if ( $node['label'] != $from && ! isset( $node['children'][ $to ] ) ) return;
// If this node has children then they need to be removed!
if ( isset( $node['children'][ $to ]['children'] ) )
{
foreach ( $node['children'][ $to ]['children'] as $childKey => $child )
{
$me->removeDefinitionArc( $roleUri, $to, $childKey );
}
}
unset( $node['children'][ $to ] );
}
);
unset( $me );
/*
foreach ( $paths as $path )
{
if ( isset( $current ) ) unset( $current );
$current =& $this->definitionRoleRefs[ $roleUri ]['hierarchy'];
$previous = null;
$previousKey = null;
$partsPath = "";
// Use the path to find the hierarchy node to be removed
$parts = explode( '/', $path );
foreach ( $parts as $part )
{
if ( ! isset( $current[ $part ] ) )
{
break;
}
$previous =& $current;
if ( ! empty( $partsPath ) ) $partsPath .= '/';
$partsPath .= $part;
$current =& $current[ $part ];
if ( ! isset( $current['children'] ) || $current['label'] == $parts[ count( $parts ) - 1 ] )
{
break;
}
$current =& $current['children'];
$previousKey = $part;
}
if ( $partsPath != $path )
{
continue;
}
// The label of $current should be $toFragment and the label of $previous should be $fromFragment
if ( $current['label'] != $to )
{
continue;
}
if ( $previousKey != $from)
{
// This means the path contains the $to node but its parent on this path is not $from
continue;
}
// If this node has children then they need to be removed!
if ( isset( $current['children'] ) )
{
foreach ( $current['children'] as $childKey => $child )
{
$this->removeDefinitionArc( $roleUri, $to, $childKey );
}
}
// Remove the arc
unset( $previous[ $to ] );
}
*/
// Remove the paths
unset( $this->definitionRoleRefs[ $roleUri ]['paths'][ $toFragment ] );
}
} | php | public function removeDefinitionArc( $roleUri, $from, $to )
{
if ( ! isset( $this->definitionRoleRefs[ $roleUri ] ) ) return false;
if ( isset( $this->definitionRoleRefs[ $roleUri ]['primaryitems'][ $to ] ) )
{
unset( $this->definitionRoleRefs[ $roleUri ]['primaryitems'][ $to ] );
}
if ( isset( $this->definitionRoleRefs[ $roleUri ]['members'][ $to ] ) )
{
unset( $this->definitionRoleRefs[ $roleUri ]['members'][ $to ] );
}
if ( isset( $this->definitionRoleRefs[ $roleUri ]['dimensions'][ $to ] ) )
{
unset( $this->definitionRoleRefs[ $roleUri ]['dimensions'][ $to ] );
}
// BMS 2017-03-21 Not using the hierarchy any more so the reference to 'paths' is redundant
return;
$toFragment = parse_url( $to, PHP_URL_FRAGMENT );
$fromFragment = parse_url( $from, PHP_URL_FRAGMENT );
if ( isset( $this->definitionRoleRefs[ $roleUri ]['paths'][ $toFragment ] ) )
{
$paths = $this->definitionRoleRefs[ $roleUri ]['paths'][ $toFragment ];
$me = $this;
$this->processNodeByPath( $this->definitionRoleRefs[ $roleUri ]['hierarchy'], $paths, $from,
function( &$node, $path, $parentKey ) use( &$me, $from, $to, $roleUri ) {
if ( $node['label'] != $from && ! isset( $node['children'][ $to ] ) ) return;
// If this node has children then they need to be removed!
if ( isset( $node['children'][ $to ]['children'] ) )
{
foreach ( $node['children'][ $to ]['children'] as $childKey => $child )
{
$me->removeDefinitionArc( $roleUri, $to, $childKey );
}
}
unset( $node['children'][ $to ] );
}
);
unset( $me );
/*
foreach ( $paths as $path )
{
if ( isset( $current ) ) unset( $current );
$current =& $this->definitionRoleRefs[ $roleUri ]['hierarchy'];
$previous = null;
$previousKey = null;
$partsPath = "";
// Use the path to find the hierarchy node to be removed
$parts = explode( '/', $path );
foreach ( $parts as $part )
{
if ( ! isset( $current[ $part ] ) )
{
break;
}
$previous =& $current;
if ( ! empty( $partsPath ) ) $partsPath .= '/';
$partsPath .= $part;
$current =& $current[ $part ];
if ( ! isset( $current['children'] ) || $current['label'] == $parts[ count( $parts ) - 1 ] )
{
break;
}
$current =& $current['children'];
$previousKey = $part;
}
if ( $partsPath != $path )
{
continue;
}
// The label of $current should be $toFragment and the label of $previous should be $fromFragment
if ( $current['label'] != $to )
{
continue;
}
if ( $previousKey != $from)
{
// This means the path contains the $to node but its parent on this path is not $from
continue;
}
// If this node has children then they need to be removed!
if ( isset( $current['children'] ) )
{
foreach ( $current['children'] as $childKey => $child )
{
$this->removeDefinitionArc( $roleUri, $to, $childKey );
}
}
// Remove the arc
unset( $previous[ $to ] );
}
*/
// Remove the paths
unset( $this->definitionRoleRefs[ $roleUri ]['paths'][ $toFragment ] );
}
} | [
"public",
"function",
"removeDefinitionArc",
"(",
"$",
"roleUri",
",",
"$",
"from",
",",
"$",
"to",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"definitionRoleRefs",
"[",
"$",
"roleUri",
"]",
")",
")",
"return",
"false",
";",
"if",
"("... | Removes an arc from the hierarchy and members or definitions list
@param string $roleUri
@param string $from
@param string $to | [
"Removes",
"an",
"arc",
"from",
"the",
"hierarchy",
"and",
"members",
"or",
"definitions",
"list"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L9761-L9879 | train |
bseddon/XBRL | XBRL.php | XBRL.isPrimaryItem | public function isPrimaryItem( $item )
{
if ( ! isset( $item['substitutionGroup'] ) ) return false;
if ( $item['substitutionGroup'] == XBRL_Constants::$xbrldtHypercubeItem /* 'hypercubeItem' */ ) return false;
if ( $item['substitutionGroup'] == XBRL_Constants::$xbrldtDimensionItem /* 'dimensionItem' */ ) return false;
if ( XBRL_Types::getInstance()->resolveToSubstitutionGroup( $item['substitutionGroup'] , array( XBRL_Constants::$xbrldtHypercubeItem ) ) ) return false;
if ( XBRL_Types::getInstance()->resolveToSubstitutionGroup( $item['substitutionGroup'] , array( XBRL_Constants::$xbrldtDimensionItem ) ) ) return false;
return true;
} | php | public function isPrimaryItem( $item )
{
if ( ! isset( $item['substitutionGroup'] ) ) return false;
if ( $item['substitutionGroup'] == XBRL_Constants::$xbrldtHypercubeItem /* 'hypercubeItem' */ ) return false;
if ( $item['substitutionGroup'] == XBRL_Constants::$xbrldtDimensionItem /* 'dimensionItem' */ ) return false;
if ( XBRL_Types::getInstance()->resolveToSubstitutionGroup( $item['substitutionGroup'] , array( XBRL_Constants::$xbrldtHypercubeItem ) ) ) return false;
if ( XBRL_Types::getInstance()->resolveToSubstitutionGroup( $item['substitutionGroup'] , array( XBRL_Constants::$xbrldtDimensionItem ) ) ) return false;
return true;
} | [
"public",
"function",
"isPrimaryItem",
"(",
"$",
"item",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"item",
"[",
"'substitutionGroup'",
"]",
")",
")",
"return",
"false",
";",
"if",
"(",
"$",
"item",
"[",
"'substitutionGroup'",
"]",
"==",
"XBRL_Constant... | Returns true if the item is an item but not dimensional
@param array $item
@return boolean | [
"Returns",
"true",
"if",
"the",
"item",
"is",
"an",
"item",
"but",
"not",
"dimensional"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L11420-L11428 | train |
bseddon/XBRL | XBRL.php | XBRL.fixupPresentationRoleHypercubes | private function fixupPresentationRoleHypercubes( $roleKey )
{
// $this->log()->info( "$role" );
if ( ! isset( $this->context->presentationRoleRefs[ $roleKey ] ) ) return;
if ( ! isset( $this->context->presentationRoleRefs[ $roleKey ]['href'] ) ) return;
// BMS 2016-02-15
/**
* @var XBRL $home_taxonomy
*/
$home_taxonomy = $this->getTaxonomyForXSD( $this->context->presentationRoleRefs[ $roleKey ]['href'] );
// $home_taxonomy = $this;
if ( ! isset( $this->context->presentationRoleRefs[ $roleKey ]['hierarchy'] ) ) return;
$home_taxonomy->ResetAllItemCaches();
$roleHypercubes = $home_taxonomy->assignNodeHypercubes( $this->context->presentationRoleRefs[ $roleKey ]['hierarchy'], $this->context->presentationRoleRefs[ $roleKey ]['locators'], $roleKey );
$this->context->presentationRoleRefs[ $roleKey ]['hypercubes'] = $roleHypercubes;
$this->pruneNodeHypercubes( $this->context->presentationRoleRefs[ $roleKey ]['hierarchy'] );
$before = count( $this->context->presentationRoleRefs[ $roleKey ]['paths'] );
// Although a 'paths' index has been built it needs to be re-built
// because the 'pruneNodeHypercubes' function is likely to have removed
// some nodes meaning the existing index will contain invalid entries
$this->context->presentationRoleRefs[ $roleKey ]['paths'] = $home_taxonomy->createHierarchyPaths( $this->context->presentationRoleRefs[ $roleKey ]['hierarchy'] );
$after = count( $this->context->presentationRoleRefs[ $roleKey ]['paths'] );
if ( $before != $after )
{
// $x = 1;
}
} | php | private function fixupPresentationRoleHypercubes( $roleKey )
{
// $this->log()->info( "$role" );
if ( ! isset( $this->context->presentationRoleRefs[ $roleKey ] ) ) return;
if ( ! isset( $this->context->presentationRoleRefs[ $roleKey ]['href'] ) ) return;
// BMS 2016-02-15
/**
* @var XBRL $home_taxonomy
*/
$home_taxonomy = $this->getTaxonomyForXSD( $this->context->presentationRoleRefs[ $roleKey ]['href'] );
// $home_taxonomy = $this;
if ( ! isset( $this->context->presentationRoleRefs[ $roleKey ]['hierarchy'] ) ) return;
$home_taxonomy->ResetAllItemCaches();
$roleHypercubes = $home_taxonomy->assignNodeHypercubes( $this->context->presentationRoleRefs[ $roleKey ]['hierarchy'], $this->context->presentationRoleRefs[ $roleKey ]['locators'], $roleKey );
$this->context->presentationRoleRefs[ $roleKey ]['hypercubes'] = $roleHypercubes;
$this->pruneNodeHypercubes( $this->context->presentationRoleRefs[ $roleKey ]['hierarchy'] );
$before = count( $this->context->presentationRoleRefs[ $roleKey ]['paths'] );
// Although a 'paths' index has been built it needs to be re-built
// because the 'pruneNodeHypercubes' function is likely to have removed
// some nodes meaning the existing index will contain invalid entries
$this->context->presentationRoleRefs[ $roleKey ]['paths'] = $home_taxonomy->createHierarchyPaths( $this->context->presentationRoleRefs[ $roleKey ]['hierarchy'] );
$after = count( $this->context->presentationRoleRefs[ $roleKey ]['paths'] );
if ( $before != $after )
{
// $x = 1;
}
} | [
"private",
"function",
"fixupPresentationRoleHypercubes",
"(",
"$",
"roleKey",
")",
"{",
"// $this->log()->info( \"$role\" );\r",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"context",
"->",
"presentationRoleRefs",
"[",
"$",
"roleKey",
"]",
")",
")",
"return"... | Assign dimensions to presentation nodes for a specific role
@param string $roleKey The role of the presentation node being
@return void | [
"Assign",
"dimensions",
"to",
"presentation",
"nodes",
"for",
"a",
"specific",
"role"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L11718-L11750 | train |
bseddon/XBRL | XBRL.php | XBRL.fixupPresentationHypercubes | public function fixupPresentationHypercubes()
{
foreach ( $this->context->presentationRoleRefs as $refsKey => $refs )
{
$this->fixupPresentationRoleHypercubes( $refsKey );
}
} | php | public function fixupPresentationHypercubes()
{
foreach ( $this->context->presentationRoleRefs as $refsKey => $refs )
{
$this->fixupPresentationRoleHypercubes( $refsKey );
}
} | [
"public",
"function",
"fixupPresentationHypercubes",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"context",
"->",
"presentationRoleRefs",
"as",
"$",
"refsKey",
"=>",
"$",
"refs",
")",
"{",
"$",
"this",
"->",
"fixupPresentationRoleHypercubes",
"(",
"$",
"... | Assign hypercubes to presentation nodes in all roles of the taxonomy
@return void | [
"Assign",
"hypercubes",
"to",
"presentation",
"nodes",
"in",
"all",
"roles",
"of",
"the",
"taxonomy"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L11756-L11762 | train |
bseddon/XBRL | XBRL.php | XBRL.fixupDefinitionRoles | public function fixupDefinitionRoles()
{
$roles = $this->getAllDefinitionRoles( true );
return;
// BMS 2017-04-05 This is no longer necessary because hierarchies are not used in definitions
foreach ( $this->definitionRoleRefs as $roleKey => $refs )
{
// BMS 2015-03-04
$home_taxonomy = $this->getTaxonomyForXSD( $refs['href'] );
// $home_taxonomy = $this;
if ( ! isset( $home_taxonomy->definitionRoleRefs[ $roleKey ] ) ||
! isset( $home_taxonomy->definitionRoleRefs[ $roleKey ]['hierarchy'] )) continue;
$home_taxonomy->definitionRoleRefs[ $roleKey ]['paths'] = $home_taxonomy->createHierarchyPaths( $home_taxonomy->definitionRoleRefs[ $roleKey ]['hierarchy'] );
}
} | php | public function fixupDefinitionRoles()
{
$roles = $this->getAllDefinitionRoles( true );
return;
// BMS 2017-04-05 This is no longer necessary because hierarchies are not used in definitions
foreach ( $this->definitionRoleRefs as $roleKey => $refs )
{
// BMS 2015-03-04
$home_taxonomy = $this->getTaxonomyForXSD( $refs['href'] );
// $home_taxonomy = $this;
if ( ! isset( $home_taxonomy->definitionRoleRefs[ $roleKey ] ) ||
! isset( $home_taxonomy->definitionRoleRefs[ $roleKey ]['hierarchy'] )) continue;
$home_taxonomy->definitionRoleRefs[ $roleKey ]['paths'] = $home_taxonomy->createHierarchyPaths( $home_taxonomy->definitionRoleRefs[ $roleKey ]['hierarchy'] );
}
} | [
"public",
"function",
"fixupDefinitionRoles",
"(",
")",
"{",
"$",
"roles",
"=",
"$",
"this",
"->",
"getAllDefinitionRoles",
"(",
"true",
")",
";",
"return",
";",
"// BMS 2017-04-05 This is no longer necessary because hierarchies are not used in definitions\r",
"foreach",
"(... | Create an index of paths for each definition role
@return void | [
"Create",
"an",
"index",
"of",
"paths",
"for",
"each",
"definition",
"role"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L11768-L11785 | train |
bseddon/XBRL | XBRL.php | XBRL.createHierarchyPaths | private function createHierarchyPaths( $nodes, $paths = array(), $path = "" )
{
foreach ( $nodes as $nodeKey => $node )
{
$nodePath = $path . ( empty( $path ) ? "" : "/" ) . $node['label'];
$parts = parse_url( $node['label'] );
$taxonomy = $parts['path'] == $this->getTaxonomyXSD()
? $this
: $this->getTaxonomyForXSD( $parts['path'] );
$taxonomy_element = $taxonomy->getElementById( $parts['fragment'] );
// $key = strpos( $node['label'], "#" ) === false ? $node['label'] : $parts[ 'fragment' ];
$key = $taxonomy_element['id'];
if ( isset( $paths[ $key ] ) )
{
// Check to make sure there is no recursion. This is indicative
// of a circular reference but these will be formally detected
// in the validation function.
if ( strpos( $path, $node['label'] ) !== false )
{
continue;
}
}
else
{
$paths[ $key ] = array();
}
$paths[ $key ][] = $nodePath;
if ( ! isset( $node['children'] ) || count( $node['children'] ) === 0 ) continue;
$paths = $this->createHierarchyPaths( $node['children'], $paths, $nodePath );
}
if ( empty( $path ) ) ksort( $paths );
return $paths;
} | php | private function createHierarchyPaths( $nodes, $paths = array(), $path = "" )
{
foreach ( $nodes as $nodeKey => $node )
{
$nodePath = $path . ( empty( $path ) ? "" : "/" ) . $node['label'];
$parts = parse_url( $node['label'] );
$taxonomy = $parts['path'] == $this->getTaxonomyXSD()
? $this
: $this->getTaxonomyForXSD( $parts['path'] );
$taxonomy_element = $taxonomy->getElementById( $parts['fragment'] );
// $key = strpos( $node['label'], "#" ) === false ? $node['label'] : $parts[ 'fragment' ];
$key = $taxonomy_element['id'];
if ( isset( $paths[ $key ] ) )
{
// Check to make sure there is no recursion. This is indicative
// of a circular reference but these will be formally detected
// in the validation function.
if ( strpos( $path, $node['label'] ) !== false )
{
continue;
}
}
else
{
$paths[ $key ] = array();
}
$paths[ $key ][] = $nodePath;
if ( ! isset( $node['children'] ) || count( $node['children'] ) === 0 ) continue;
$paths = $this->createHierarchyPaths( $node['children'], $paths, $nodePath );
}
if ( empty( $path ) ) ksort( $paths );
return $paths;
} | [
"private",
"function",
"createHierarchyPaths",
"(",
"$",
"nodes",
",",
"$",
"paths",
"=",
"array",
"(",
")",
",",
"$",
"path",
"=",
"\"\"",
")",
"{",
"foreach",
"(",
"$",
"nodes",
"as",
"$",
"nodeKey",
"=>",
"$",
"node",
")",
"{",
"$",
"nodePath",
... | Process the nodes of a role hierarchy to build a primary items path index
@param array $nodes An array of nodes, ones that have a 'children' element
@param array $paths An array of paths accumulated to date. Defaults to an empty array.
@param string $path The node path of the parent. Defaults to an empty string
@return An array indexed by node labels of paths to each node | [
"Process",
"the",
"nodes",
"of",
"a",
"role",
"hierarchy",
"to",
"build",
"a",
"primary",
"items",
"path",
"index"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L11805-L11842 | train |
bseddon/XBRL | XBRL.php | XBRL.processAllNodes | public function processAllNodes( &$nodes, $callback = false )
{
if ( ! $callback ) return; // Nothing to do except waste time
foreach( $nodes as $id => $node )
{
$result = $callback( $node, $id );
if ( $result === false ) return false;
if ( ! isset( $node['children'] ) ) continue;
$result = $this->processAllNodes( $node['children'], $callback );
if ( $result === false ) return false;
}
} | php | public function processAllNodes( &$nodes, $callback = false )
{
if ( ! $callback ) return; // Nothing to do except waste time
foreach( $nodes as $id => $node )
{
$result = $callback( $node, $id );
if ( $result === false ) return false;
if ( ! isset( $node['children'] ) ) continue;
$result = $this->processAllNodes( $node['children'], $callback );
if ( $result === false ) return false;
}
} | [
"public",
"function",
"processAllNodes",
"(",
"&",
"$",
"nodes",
",",
"$",
"callback",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"callback",
")",
"return",
";",
"// Nothing to do except waste time\r",
"foreach",
"(",
"$",
"nodes",
"as",
"$",
"id",
"=>",... | Iterate over a set of nodes calling a callback for each one
@param array $nodes A root node collection to process
@param string $callback A function called for each node. The node and id are passed.
If the function returns false the processing will stop | [
"Iterate",
"over",
"a",
"set",
"of",
"nodes",
"calling",
"a",
"callback",
"for",
"each",
"one"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L12834-L12848 | train |
bseddon/XBRL | XBRL.php | XBRL.processNodeByPath | public function processNodeByPath( &$nodes, &$paths, $node, $successCallback = false, $failureCallback = false )
{
$result = true;
if ( is_null( $nodes ) ) return;
foreach ( $paths as $pathKey => $path )
{
unset( $currentNodes );
unset( $currentNode );
unset( $parentNode );
$currentNodes =& $nodes;
$currentPath = "";
$currentNode = false;
$parentNode = false;
$pathsParts = explode( '/', $path );
for ( $i = 0; $i < count( $pathsParts ); $i++ )
{
if ( ! isset( $currentNodes[ $pathsParts[ $i ] ] ) )
{
// XBRL_Log::getInstance()->err( "This is bad" );
unset( $currentNodes );
$currentNodes = false;
$parentNode = false;
break;
}
$currentNode =& $currentNodes[ $pathsParts[ $i ] ];
if ( $pathsParts[ $i ] == $node )
{
break;
}
$parentNode = $currentNode;
if ( isset( $currentNode['children'] ) )
{
$currentNodes =& $currentNode['children'];
}
}
if ( ! $currentNodes )
{
if ( $failureCallback )
{
$failureCallback( $path );
}
else
{
XBRL_Log::getInstance()->warning( "There are no current nodes so something went wrong evaluating the path '$path'" );
}
continue;
}
if ( ! $successCallback ) continue;
$successCallback( $currentNode, $path, $parentNode === false ? $parentNode : $parentNode['label'] );
}
return $result;
} | php | public function processNodeByPath( &$nodes, &$paths, $node, $successCallback = false, $failureCallback = false )
{
$result = true;
if ( is_null( $nodes ) ) return;
foreach ( $paths as $pathKey => $path )
{
unset( $currentNodes );
unset( $currentNode );
unset( $parentNode );
$currentNodes =& $nodes;
$currentPath = "";
$currentNode = false;
$parentNode = false;
$pathsParts = explode( '/', $path );
for ( $i = 0; $i < count( $pathsParts ); $i++ )
{
if ( ! isset( $currentNodes[ $pathsParts[ $i ] ] ) )
{
// XBRL_Log::getInstance()->err( "This is bad" );
unset( $currentNodes );
$currentNodes = false;
$parentNode = false;
break;
}
$currentNode =& $currentNodes[ $pathsParts[ $i ] ];
if ( $pathsParts[ $i ] == $node )
{
break;
}
$parentNode = $currentNode;
if ( isset( $currentNode['children'] ) )
{
$currentNodes =& $currentNode['children'];
}
}
if ( ! $currentNodes )
{
if ( $failureCallback )
{
$failureCallback( $path );
}
else
{
XBRL_Log::getInstance()->warning( "There are no current nodes so something went wrong evaluating the path '$path'" );
}
continue;
}
if ( ! $successCallback ) continue;
$successCallback( $currentNode, $path, $parentNode === false ? $parentNode : $parentNode['label'] );
}
return $result;
} | [
"public",
"function",
"processNodeByPath",
"(",
"&",
"$",
"nodes",
",",
"&",
"$",
"paths",
",",
"$",
"node",
",",
"$",
"successCallback",
"=",
"false",
",",
"$",
"failureCallback",
"=",
"false",
")",
"{",
"$",
"result",
"=",
"true",
";",
"if",
"(",
"... | Find all nodes assocated with an array of paths then call a callback when found or not found
@param array $nodes A root node collection in which to find $node
@param array $paths An array of path indices
@param string $node A label representing the node to find
@param function $successCallback A function to call when a node is located.
Will pass $node, the path to $node and the parent key of $node.
The parent key will be false if $node is the root.
@param function $failureCallback Called if $node is not found in $nodes. Passes $path.
@return boolean|array An array representing the the node of $node from the $nodes hierarchy | [
"Find",
"all",
"nodes",
"assocated",
"with",
"an",
"array",
"of",
"paths",
"then",
"call",
"a",
"callback",
"when",
"found",
"or",
"not",
"found"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L12861-L12923 | train |
bseddon/XBRL | XBRL.php | XBRL.reportMissingXLinkAttribute | private function reportMissingXLinkAttribute( $section, $message, $attributeName, $linkbase ) {
$this->log()->taxonomy_validation( $section, $message,
array(
'attribute' => $attributeName,
'linkbase' => $linkbase,
)
);
return false;
} | php | private function reportMissingXLinkAttribute( $section, $message, $attributeName, $linkbase ) {
$this->log()->taxonomy_validation( $section, $message,
array(
'attribute' => $attributeName,
'linkbase' => $linkbase,
)
);
return false;
} | [
"private",
"function",
"reportMissingXLinkAttribute",
"(",
"$",
"section",
",",
"$",
"message",
",",
"$",
"attributeName",
",",
"$",
"linkbase",
")",
"{",
"$",
"this",
"->",
"log",
"(",
")",
"->",
"taxonomy_validation",
"(",
"$",
"section",
",",
"$",
"mess... | Part of the validation system to report missing XLink attributes
@param string $section The numeric identifier of this attribute issue
@param string $message The message to display
@param string $attributeName The name of the missing attribute
@param string $linkbase
@return false | [
"Part",
"of",
"the",
"validation",
"system",
"to",
"report",
"missing",
"XLink",
"attributes"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L12948-L12956 | train |
bseddon/XBRL | XBRL.php | XBRL.reportMissingLocatorAttribute | private function reportMissingLocatorAttribute( $section, $attributeName, $linkbase ) {
$this->log()->reportMissingXLinkAttribute( $section, "Locators MUST include required XLink attributes", $attributeName, $linkbase );
return false;
} | php | private function reportMissingLocatorAttribute( $section, $attributeName, $linkbase ) {
$this->log()->reportMissingXLinkAttribute( $section, "Locators MUST include required XLink attributes", $attributeName, $linkbase );
return false;
} | [
"private",
"function",
"reportMissingLocatorAttribute",
"(",
"$",
"section",
",",
"$",
"attributeName",
",",
"$",
"linkbase",
")",
"{",
"$",
"this",
"->",
"log",
"(",
")",
"->",
"reportMissingXLinkAttribute",
"(",
"$",
"section",
",",
"\"Locators MUST include requ... | Part of the validation system to report missing locator XLink attributes
@param string $section The numeric identifier of this attribute issue
@param string $attributeName The name of the missing attribute
@param string $linkbase
@return false | [
"Part",
"of",
"the",
"validation",
"system",
"to",
"report",
"missing",
"locator",
"XLink",
"attributes"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L12966-L12969 | train |
bseddon/XBRL | XBRL.php | XBRL.reportMissingResourceAttribute | private function reportMissingResourceAttribute( $section, $attributeName, $linkbase ) {
$this->reportMissingXLinkAttribute( $section, "Resources MUST include required XLink attributes", $attributeName, $linkbase );
return false;
} | php | private function reportMissingResourceAttribute( $section, $attributeName, $linkbase ) {
$this->reportMissingXLinkAttribute( $section, "Resources MUST include required XLink attributes", $attributeName, $linkbase );
return false;
} | [
"private",
"function",
"reportMissingResourceAttribute",
"(",
"$",
"section",
",",
"$",
"attributeName",
",",
"$",
"linkbase",
")",
"{",
"$",
"this",
"->",
"reportMissingXLinkAttribute",
"(",
"$",
"section",
",",
"\"Resources MUST include required XLink attributes\"",
"... | Part of the validation system to report missing resource XLink attributes
@param string $section The numeric identifier of this attribute issue
@param string $attributeName The name of the missing attribute
@param string $linkbase
@return false | [
"Part",
"of",
"the",
"validation",
"system",
"to",
"report",
"missing",
"resource",
"XLink",
"attributes"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L12979-L12982 | train |
bseddon/XBRL | XBRL.php | XBRL.reportMissingArcAttribute | private function reportMissingArcAttribute( $section, $attributeName, $linkbase ) {
$this->reportMissingXLinkAttribute( $section, "Arcs MUST include required XLink attributes", $attributeName, $linkbase );
return false;
} | php | private function reportMissingArcAttribute( $section, $attributeName, $linkbase ) {
$this->reportMissingXLinkAttribute( $section, "Arcs MUST include required XLink attributes", $attributeName, $linkbase );
return false;
} | [
"private",
"function",
"reportMissingArcAttribute",
"(",
"$",
"section",
",",
"$",
"attributeName",
",",
"$",
"linkbase",
")",
"{",
"$",
"this",
"->",
"reportMissingXLinkAttribute",
"(",
"$",
"section",
",",
"\"Arcs MUST include required XLink attributes\"",
",",
"$",... | Part of the validation system to report missing arc XLink attributes
@param string $section The numeric identifier of this attribute issue
@param string $attributeName The name of the missing attribute
@param string $linkbase
@return false | [
"Part",
"of",
"the",
"validation",
"system",
"to",
"report",
"missing",
"arc",
"XLink",
"attributes"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L12992-L12995 | train |
bseddon/XBRL | XBRL.php | XBRL.reportNoRoleLinks | private function reportNoRoleLinks( $linkbaseRef, $linkbase )
{
$xml_basename = basename( $linkbaseRef['href'] );
$this->log()->taxonomy_validation( "4.3.3", "The content of the linkbase file does not match the role specified",
array(
'url' => "'$xml_basename'",
'role' => "'{$linkbaseRef['role']}'",
'link type' => $linkbase,
)
);
return false;
} | php | private function reportNoRoleLinks( $linkbaseRef, $linkbase )
{
$xml_basename = basename( $linkbaseRef['href'] );
$this->log()->taxonomy_validation( "4.3.3", "The content of the linkbase file does not match the role specified",
array(
'url' => "'$xml_basename'",
'role' => "'{$linkbaseRef['role']}'",
'link type' => $linkbase,
)
);
return false;
} | [
"private",
"function",
"reportNoRoleLinks",
"(",
"$",
"linkbaseRef",
",",
"$",
"linkbase",
")",
"{",
"$",
"xml_basename",
"=",
"basename",
"(",
"$",
"linkbaseRef",
"[",
"'href'",
"]",
")",
";",
"$",
"this",
"->",
"log",
"(",
")",
"->",
"taxonomy_validation... | Part of the validation system to report that the content of the linkbase file does not match the role specified
@param array $linkbaseRef An array containing standard linkbase information
@param string $linkbase
@return false | [
"Part",
"of",
"the",
"validation",
"system",
"to",
"report",
"that",
"the",
"content",
"of",
"the",
"linkbase",
"file",
"does",
"not",
"match",
"the",
"role",
"specified"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L13020-L13032 | train |
bseddon/XBRL | XBRL.php | XBRL.reportXLinkTypeError | private function reportXLinkTypeError( $section, $message, $linkbase, $value )
{
$this->log()->taxonomy_validation( $section, $message,
array(
'linkbase' => $linkbase,
'value' => $value,
)
);
return false;
} | php | private function reportXLinkTypeError( $section, $message, $linkbase, $value )
{
$this->log()->taxonomy_validation( $section, $message,
array(
'linkbase' => $linkbase,
'value' => $value,
)
);
return false;
} | [
"private",
"function",
"reportXLinkTypeError",
"(",
"$",
"section",
",",
"$",
"message",
",",
"$",
"linkbase",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"log",
"(",
")",
"->",
"taxonomy_validation",
"(",
"$",
"section",
",",
"$",
"message",
",",
... | Report a problem with the value of an XLink type attribute
@param string $section
@param string $message The message to display
@param string $linkbase The linkbase type containing the error
@param string $value The value of the type
@return boolean | [
"Report",
"a",
"problem",
"with",
"the",
"value",
"of",
"an",
"XLink",
"type",
"attribute"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L13043-L13053 | train |
bseddon/XBRL | XBRL.php | XBRL.reportXLinkLocatorTypeError | private function reportXLinkLocatorTypeError( $section, $linkbase, $value )
{
$this->log()->reportXLinkTypeError( $section, "The content of the locator type MUST be 'locator'", $linkbase, $value );
return false;
} | php | private function reportXLinkLocatorTypeError( $section, $linkbase, $value )
{
$this->log()->reportXLinkTypeError( $section, "The content of the locator type MUST be 'locator'", $linkbase, $value );
return false;
} | [
"private",
"function",
"reportXLinkLocatorTypeError",
"(",
"$",
"section",
",",
"$",
"linkbase",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"log",
"(",
")",
"->",
"reportXLinkTypeError",
"(",
"$",
"section",
",",
"\"The content of the locator type MUST be 'lo... | Report a problem with the value of an XLink type attribute of a 'locator' element
@param string $section The section of the specificiation for which an error is being reported
@param string $linkbase The linkbase type containing the error
@param string $value The value of the type
@return boolean | [
"Report",
"a",
"problem",
"with",
"the",
"value",
"of",
"an",
"XLink",
"type",
"attribute",
"of",
"a",
"locator",
"element"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L13063-L13067 | train |
bseddon/XBRL | XBRL.php | XBRL.validateXLinkLabel | private function validateXLinkLabel( $linkbase, $value )
{
if ( ! XBRL::isValidating() ) return true;
if ( preg_match( '/^[\pL_]/', $value ) ) return true;
// if ( ! empty( $value ) && ( ctype_alpha( $value[0] ) || $value[0] == '_' ) ) return true;
return $this->reportXLinkTypeError( "3.5.3.7.3", "Error validating linkbase", $linkbase, $value );
} | php | private function validateXLinkLabel( $linkbase, $value )
{
if ( ! XBRL::isValidating() ) return true;
if ( preg_match( '/^[\pL_]/', $value ) ) return true;
// if ( ! empty( $value ) && ( ctype_alpha( $value[0] ) || $value[0] == '_' ) ) return true;
return $this->reportXLinkTypeError( "3.5.3.7.3", "Error validating linkbase", $linkbase, $value );
} | [
"private",
"function",
"validateXLinkLabel",
"(",
"$",
"linkbase",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"XBRL",
"::",
"isValidating",
"(",
")",
")",
"return",
"true",
";",
"if",
"(",
"preg_match",
"(",
"'/^[\\pL_]/'",
",",
"$",
"value",
")",
")... | Validate an XLink label
@param string $linkbase
@param string $value The value of the type
@return boolean | [
"Validate",
"an",
"XLink",
"label"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L13104-L13112 | train |
bseddon/XBRL | XBRL.php | XBRL.validateXLinkLocatorType | private function validateXLinkLocatorType( $linkbase, $value )
{
if ( ! XBRL::isValidating() ) return true;
if ( $value == 'locator' ) return true;
return $this->reportXLinkLocatorTypeError( "3.5.3.7.1", $linkbase, $value );
} | php | private function validateXLinkLocatorType( $linkbase, $value )
{
if ( ! XBRL::isValidating() ) return true;
if ( $value == 'locator' ) return true;
return $this->reportXLinkLocatorTypeError( "3.5.3.7.1", $linkbase, $value );
} | [
"private",
"function",
"validateXLinkLocatorType",
"(",
"$",
"linkbase",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"XBRL",
"::",
"isValidating",
"(",
")",
")",
"return",
"true",
";",
"if",
"(",
"$",
"value",
"==",
"'locator'",
")",
"return",
"true",
... | A locator MUST have a type and its value MUST be 'locator'
@param string $linkbase
@param string $value The value of the type
@return boolean | [
"A",
"locator",
"MUST",
"have",
"a",
"type",
"and",
"its",
"value",
"MUST",
"be",
"locator"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L13121-L13128 | train |
bseddon/XBRL | XBRL.php | XBRL.validateXLinkLocatorAttributes | private function validateXLinkLocatorAttributes( $xlinkAttributes, $linkbaseName, $linkbaseHRef )
{
if ( ! XBRL::isValidating() ) return true;
$result = true;
if ( ! property_exists( $xlinkAttributes, 'type' ) )
{
$this->reportMissingLocatorAttribute( '3.5.3.7.1', 'type', $linkbaseName );
$result = false;
}
if ( ! property_exists( $xlinkAttributes, 'label' ) )
{
$this->reportMissingLocatorAttribute( '3.5.3.7.3', 'label', $linkbaseName );
$result = false;
}
if ( ! property_exists( $xlinkAttributes, 'href' ) )
{
$this->reportMissingLocatorAttribute( '3.5.3.7.2', 'href', $linkbaseName );
return false;
}
// BMS 2018-04-16 This have been moved to a function called 'validateLocator'
// $href = (string) $xlinkAttributes->href;
// $parts = parse_url( $href );
// if ( ! isset( $parts['path'] ) )
// {
// if ( ! isset( $parts['fragment'] ) )
// {
// $this->log()->taxonomy_validation( "3.5.3.7.2", "The href of the locator is not valid",
// array(
// 'linkbase' => $linkbaseName,
// 'href' => $href,
// )
// );
//
// return false;
// }
//
// // The locator points to a reference that has already been loaded. Just check that it has.
// $result = isset( $this->linkbaseIds[ basename( $linkbaseHRef ) ][ trim( $parts['fragment'], '#' ) ] );
// return $result;
// }
//
// if ( XBRL::endsWith( $parts['path'], '.xml' ) )
// {
// // It's a linkbase reference
// if ( isset( $this->linkbaseIds[ $parts['path'] ] ) )
// {
// return true;
// }
//
// $linkbaseRef = array(
// 'type' => (string) $xlinkAttributes->type,
// // BMS 2017-10-27 This makes the linkbase relative to the location of the schema file which is not correct
// // 'href' => XBRL::resolve_path( $taxonomy->getSchemaLocation(), $href ),
// 'href' => XBRL::resolve_path( $this->schemaLocation, $parts['path'] ),
// 'role' => XBRL_Constants::$anyLinkbaseRef,
// 'arcrole' => \XBRL_Constants::$arcRoleLinkbase,
// 'title' => '',
// 'base' => '',
// );
//
// $this->processPresentationLinkbase( $linkbaseRef );
// $this->processLabelLinkbase( $linkbaseRef );
// $this->processDefinitionLinkbase( $linkbaseRef );
// $this->processCalculationLinkbase( $linkbaseRef );
// // Handle custom linkbases
// $this->processCustomLinkbaseArcRoles( $linkbaseRef );
//
// return true;
// }
//
// /**
// * @var XBRL $taxonomy
// */
// $taxonomy = $parts['path'] == $this->getTaxonomyXSD()
// ? $this
// : $this->getTaxonomyForXSD( $parts['path'] );
//
// if ( ! $taxonomy )
// {
// // If the linkbase is 'label' look in the labels
// if ( $linkbaseName == 'labels' )
// {
// $labelsHref =& $this->context->labels[ XBRL_Constants::$defaultLinkRole ]['labelshref'];
// if ( ! isset( $labelsHref[ basename( $parts['path'] ) ] ) ||
// ! isset( $labelsHref[ basename( $parts['path'] ) ][ $parts['fragment'] ] ) )
// {
// $result = false;
// }
// }
// else
// {
// // Look for the taxonomy and include its contents in the DTS
// $xsd = $this->resolve_path( $this->getSchemaLocation(), $href );
// $xsd = strpos( $xsd, '#' ) ? strstr( $xsd, '#', true ) : $xsd;
//
// $taxonomy = XBRL::withTaxonomy( $xsd );
// // $taxonomy = $this->getTaxonomyForXSD( $xsd );
// }
// }
//
// if ( $taxonomy )
// {
// // BMS 2018-04-16 This is required by the XBRL 2.1 specification (see test 2012 V-02)
// $element =& $taxonomy->getElementById( $parts['fragment'] );
// if ( ! $element )
// {
// $this->log()->taxonomy_validation( "3.5.3.9.2", "The concept of the locator does not exist in the DTS",
// array(
// 'href' => $href,
// 'linkbase' => $linkbaseName,
// )
// );
// $result = false;
// }
// }
// else
// {
// $this->log()->taxonomy_validation( "3.5.3.7.2", "The document of the locator does not exist in the DTS",
// array(
// 'href' => $href,
// 'linkbase' => $linkbaseName,
// )
// );
// $result = false;
// }
return $result;
} | php | private function validateXLinkLocatorAttributes( $xlinkAttributes, $linkbaseName, $linkbaseHRef )
{
if ( ! XBRL::isValidating() ) return true;
$result = true;
if ( ! property_exists( $xlinkAttributes, 'type' ) )
{
$this->reportMissingLocatorAttribute( '3.5.3.7.1', 'type', $linkbaseName );
$result = false;
}
if ( ! property_exists( $xlinkAttributes, 'label' ) )
{
$this->reportMissingLocatorAttribute( '3.5.3.7.3', 'label', $linkbaseName );
$result = false;
}
if ( ! property_exists( $xlinkAttributes, 'href' ) )
{
$this->reportMissingLocatorAttribute( '3.5.3.7.2', 'href', $linkbaseName );
return false;
}
// BMS 2018-04-16 This have been moved to a function called 'validateLocator'
// $href = (string) $xlinkAttributes->href;
// $parts = parse_url( $href );
// if ( ! isset( $parts['path'] ) )
// {
// if ( ! isset( $parts['fragment'] ) )
// {
// $this->log()->taxonomy_validation( "3.5.3.7.2", "The href of the locator is not valid",
// array(
// 'linkbase' => $linkbaseName,
// 'href' => $href,
// )
// );
//
// return false;
// }
//
// // The locator points to a reference that has already been loaded. Just check that it has.
// $result = isset( $this->linkbaseIds[ basename( $linkbaseHRef ) ][ trim( $parts['fragment'], '#' ) ] );
// return $result;
// }
//
// if ( XBRL::endsWith( $parts['path'], '.xml' ) )
// {
// // It's a linkbase reference
// if ( isset( $this->linkbaseIds[ $parts['path'] ] ) )
// {
// return true;
// }
//
// $linkbaseRef = array(
// 'type' => (string) $xlinkAttributes->type,
// // BMS 2017-10-27 This makes the linkbase relative to the location of the schema file which is not correct
// // 'href' => XBRL::resolve_path( $taxonomy->getSchemaLocation(), $href ),
// 'href' => XBRL::resolve_path( $this->schemaLocation, $parts['path'] ),
// 'role' => XBRL_Constants::$anyLinkbaseRef,
// 'arcrole' => \XBRL_Constants::$arcRoleLinkbase,
// 'title' => '',
// 'base' => '',
// );
//
// $this->processPresentationLinkbase( $linkbaseRef );
// $this->processLabelLinkbase( $linkbaseRef );
// $this->processDefinitionLinkbase( $linkbaseRef );
// $this->processCalculationLinkbase( $linkbaseRef );
// // Handle custom linkbases
// $this->processCustomLinkbaseArcRoles( $linkbaseRef );
//
// return true;
// }
//
// /**
// * @var XBRL $taxonomy
// */
// $taxonomy = $parts['path'] == $this->getTaxonomyXSD()
// ? $this
// : $this->getTaxonomyForXSD( $parts['path'] );
//
// if ( ! $taxonomy )
// {
// // If the linkbase is 'label' look in the labels
// if ( $linkbaseName == 'labels' )
// {
// $labelsHref =& $this->context->labels[ XBRL_Constants::$defaultLinkRole ]['labelshref'];
// if ( ! isset( $labelsHref[ basename( $parts['path'] ) ] ) ||
// ! isset( $labelsHref[ basename( $parts['path'] ) ][ $parts['fragment'] ] ) )
// {
// $result = false;
// }
// }
// else
// {
// // Look for the taxonomy and include its contents in the DTS
// $xsd = $this->resolve_path( $this->getSchemaLocation(), $href );
// $xsd = strpos( $xsd, '#' ) ? strstr( $xsd, '#', true ) : $xsd;
//
// $taxonomy = XBRL::withTaxonomy( $xsd );
// // $taxonomy = $this->getTaxonomyForXSD( $xsd );
// }
// }
//
// if ( $taxonomy )
// {
// // BMS 2018-04-16 This is required by the XBRL 2.1 specification (see test 2012 V-02)
// $element =& $taxonomy->getElementById( $parts['fragment'] );
// if ( ! $element )
// {
// $this->log()->taxonomy_validation( "3.5.3.9.2", "The concept of the locator does not exist in the DTS",
// array(
// 'href' => $href,
// 'linkbase' => $linkbaseName,
// )
// );
// $result = false;
// }
// }
// else
// {
// $this->log()->taxonomy_validation( "3.5.3.7.2", "The document of the locator does not exist in the DTS",
// array(
// 'href' => $href,
// 'linkbase' => $linkbaseName,
// )
// );
// $result = false;
// }
return $result;
} | [
"private",
"function",
"validateXLinkLocatorAttributes",
"(",
"$",
"xlinkAttributes",
",",
"$",
"linkbaseName",
",",
"$",
"linkbaseHRef",
")",
"{",
"if",
"(",
"!",
"XBRL",
"::",
"isValidating",
"(",
")",
")",
"return",
"true",
";",
"$",
"result",
"=",
"true"... | Validate the existence of XLink properties for locators
@param SimpleXMLElement $xlinkAttributes
@param string $linkbaseName
@param array $linkbaseHRef
@return boolean | [
"Validate",
"the",
"existence",
"of",
"XLink",
"properties",
"for",
"locators"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L13138-L13270 | train |
bseddon/XBRL | XBRL.php | XBRL.validateXLinkResourceType | private function validateXLinkResourceType( $linkbase, $value )
{
if ( ! XBRL::isValidating() ) return true;
if ( $value == 'resource' ) return true;
return $this->reportXLinkResourceTypeError( "3.5.3.8.1", $linkbase, $value );
} | php | private function validateXLinkResourceType( $linkbase, $value )
{
if ( ! XBRL::isValidating() ) return true;
if ( $value == 'resource' ) return true;
return $this->reportXLinkResourceTypeError( "3.5.3.8.1", $linkbase, $value );
} | [
"private",
"function",
"validateXLinkResourceType",
"(",
"$",
"linkbase",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"XBRL",
"::",
"isValidating",
"(",
")",
")",
"return",
"true",
";",
"if",
"(",
"$",
"value",
"==",
"'resource'",
")",
"return",
"true",... | A locator MUST have a type and its value MUST be 'resource'
@param string $linkbase
@param string $value The value of the type
@return boolean | [
"A",
"locator",
"MUST",
"have",
"a",
"type",
"and",
"its",
"value",
"MUST",
"be",
"resource"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L13413-L13420 | train |
bseddon/XBRL | XBRL.php | XBRL.validateXLinkResourceAttributes | private function validateXLinkResourceAttributes( $xlinkAttributes, $linkbase )
{
if ( ! XBRL::isValidating() ) return true;
$result = true;
if ( ! property_exists( $xlinkAttributes, 'type' ) )
{
$this->reportMissingResourceAttribute( '3.5.3.8.1', 'type', $linkbase );
$result = false;
}
if ( ! property_exists( $xlinkAttributes, 'role' ) )
{
$this->reportMissingResourceAttribute( '3.5.3.8.3', 'role', $linkbase );
$result = false;
}
if ( ! property_exists( $xlinkAttributes, 'label' ) )
{
$this->reportMissingResourceAttribute( '3.5.3.8.2', 'label', $linkbase );
$result = false;
}
return true;
} | php | private function validateXLinkResourceAttributes( $xlinkAttributes, $linkbase )
{
if ( ! XBRL::isValidating() ) return true;
$result = true;
if ( ! property_exists( $xlinkAttributes, 'type' ) )
{
$this->reportMissingResourceAttribute( '3.5.3.8.1', 'type', $linkbase );
$result = false;
}
if ( ! property_exists( $xlinkAttributes, 'role' ) )
{
$this->reportMissingResourceAttribute( '3.5.3.8.3', 'role', $linkbase );
$result = false;
}
if ( ! property_exists( $xlinkAttributes, 'label' ) )
{
$this->reportMissingResourceAttribute( '3.5.3.8.2', 'label', $linkbase );
$result = false;
}
return true;
} | [
"private",
"function",
"validateXLinkResourceAttributes",
"(",
"$",
"xlinkAttributes",
",",
"$",
"linkbase",
")",
"{",
"if",
"(",
"!",
"XBRL",
"::",
"isValidating",
"(",
")",
")",
"return",
"true",
";",
"$",
"result",
"=",
"true",
";",
"if",
"(",
"!",
"p... | Validate the existence of XLink properties for resources
@param SimpleXMLElement $xlinkAttributes
@param string $linkbase
@return boolean | [
"Validate",
"the",
"existence",
"of",
"XLink",
"properties",
"for",
"resources"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L13429-L13454 | train |
bseddon/XBRL | XBRL.php | XBRL.validateArcAttributes | private function validateArcAttributes( $linkbase, $from, $to, $attributes )
{
$result['priority'] = property_exists( $attributes, 'priority' ) ? (string) $attributes->priority : "0";
$result['use'] = property_exists( $attributes, 'use' ) ? (string) $attributes->use : XBRL_Constants::$xlinkUseOptional;
$result['order'] = property_exists( $attributes, 'order' ) ? (string) $attributes->order : "1";
$result['title'] = property_exists( $attributes, 'title' ) ? (string) $attributes->title : "";
if ( filter_var( $result['priority'], FILTER_VALIDATE_INT ) === false )
{
$this->log()->taxonomy_validation( "3.5.3.9.5", "The arc priority value MUST be an integer",
array(
'linkbase' => $linkbase,
'from' => $fromLabel,
'to' => $toLabel,
'priority' => $result['priority'],
)
);
}
if ( ! in_array( $result['use'], XBRL_Constants::$xlinkUseValues ) )
{
$this->log()->taxonomy_validation( "3.5.3.9.5", "The arc priority value MUST be an integer",
array(
'linkbase' => $linkbase,
'from' => $fromLabel,
'to' => $toLabel,
'use' => $result['use'],
)
);
}
if ( ! is_numeric( $result['order'] ) )
{
$this->log()->taxonomy_validation( "3.5.3.9.5", "The arc order value MUST be numeric",
array(
'linkbase' => $linkbase,
'from' => $fromLabel,
'to' => $toLabel,
'order' => $result['order'],
)
);
}
return $result;
} | php | private function validateArcAttributes( $linkbase, $from, $to, $attributes )
{
$result['priority'] = property_exists( $attributes, 'priority' ) ? (string) $attributes->priority : "0";
$result['use'] = property_exists( $attributes, 'use' ) ? (string) $attributes->use : XBRL_Constants::$xlinkUseOptional;
$result['order'] = property_exists( $attributes, 'order' ) ? (string) $attributes->order : "1";
$result['title'] = property_exists( $attributes, 'title' ) ? (string) $attributes->title : "";
if ( filter_var( $result['priority'], FILTER_VALIDATE_INT ) === false )
{
$this->log()->taxonomy_validation( "3.5.3.9.5", "The arc priority value MUST be an integer",
array(
'linkbase' => $linkbase,
'from' => $fromLabel,
'to' => $toLabel,
'priority' => $result['priority'],
)
);
}
if ( ! in_array( $result['use'], XBRL_Constants::$xlinkUseValues ) )
{
$this->log()->taxonomy_validation( "3.5.3.9.5", "The arc priority value MUST be an integer",
array(
'linkbase' => $linkbase,
'from' => $fromLabel,
'to' => $toLabel,
'use' => $result['use'],
)
);
}
if ( ! is_numeric( $result['order'] ) )
{
$this->log()->taxonomy_validation( "3.5.3.9.5", "The arc order value MUST be numeric",
array(
'linkbase' => $linkbase,
'from' => $fromLabel,
'to' => $toLabel,
'order' => $result['order'],
)
);
}
return $result;
} | [
"private",
"function",
"validateArcAttributes",
"(",
"$",
"linkbase",
",",
"$",
"from",
",",
"$",
"to",
",",
"$",
"attributes",
")",
"{",
"$",
"result",
"[",
"'priority'",
"]",
"=",
"property_exists",
"(",
"$",
"attributes",
",",
"'priority'",
")",
"?",
... | Check the priority, order and use attributes and return them in an indexed array
@param string $linkbase
@param string $from
@param string $to
@param SimpleXMLElement $attributes
@return array | [
"Check",
"the",
"priority",
"order",
"and",
"use",
"attributes",
"and",
"return",
"them",
"in",
"an",
"indexed",
"array"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L13464-L13508 | train |
bseddon/XBRL | XBRL.php | XBRL.validateXLinkArcType | private function validateXLinkArcType( $linkbase, $value )
{
if ( ! XBRL::isValidating() ) return true;
if ( $value == 'arc' ) return true;
return $this->reportXLinkArcTypeError( "3.5.3.9.1", $linkbase, $value );
} | php | private function validateXLinkArcType( $linkbase, $value )
{
if ( ! XBRL::isValidating() ) return true;
if ( $value == 'arc' ) return true;
return $this->reportXLinkArcTypeError( "3.5.3.9.1", $linkbase, $value );
} | [
"private",
"function",
"validateXLinkArcType",
"(",
"$",
"linkbase",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"XBRL",
"::",
"isValidating",
"(",
")",
")",
"return",
"true",
";",
"if",
"(",
"$",
"value",
"==",
"'arc'",
")",
"return",
"true",
";",
... | A locator MUST have a type and its value MUST be 'arc'
@param string $linkbase
@param string $value The value of the type
@return boolean | [
"A",
"locator",
"MUST",
"have",
"a",
"type",
"and",
"its",
"value",
"MUST",
"be",
"arc"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L13517-L13524 | train |
bseddon/XBRL | XBRL.php | XBRL.validateXLinkArcAttributes | private function validateXLinkArcAttributes( $xlinkAttributes, $linkbase )
{
if ( ! XBRL::isValidating() ) return true;
$result = true;
if ( ! property_exists( $xlinkAttributes, 'arcrole' ) )
{
$this->reportMissingArcAttribute( '3.5.3.9.4', 'arcrole', $linkbase );
$result = false;
}
if ( ! property_exists( $xlinkAttributes, 'to' ) )
{
$this->reportMissingArcAttribute( '3.5.3.9.3', 'to', $linkbase );
$result = false;
}
if ( ! property_exists( $xlinkAttributes, 'from' ) )
{
$this->reportMissingArcAttribute( '3.5.3.9.2', 'from', $linkbase );
$result = false;
}
return true;
} | php | private function validateXLinkArcAttributes( $xlinkAttributes, $linkbase )
{
if ( ! XBRL::isValidating() ) return true;
$result = true;
if ( ! property_exists( $xlinkAttributes, 'arcrole' ) )
{
$this->reportMissingArcAttribute( '3.5.3.9.4', 'arcrole', $linkbase );
$result = false;
}
if ( ! property_exists( $xlinkAttributes, 'to' ) )
{
$this->reportMissingArcAttribute( '3.5.3.9.3', 'to', $linkbase );
$result = false;
}
if ( ! property_exists( $xlinkAttributes, 'from' ) )
{
$this->reportMissingArcAttribute( '3.5.3.9.2', 'from', $linkbase );
$result = false;
}
return true;
} | [
"private",
"function",
"validateXLinkArcAttributes",
"(",
"$",
"xlinkAttributes",
",",
"$",
"linkbase",
")",
"{",
"if",
"(",
"!",
"XBRL",
"::",
"isValidating",
"(",
")",
")",
"return",
"true",
";",
"$",
"result",
"=",
"true",
";",
"if",
"(",
"!",
"proper... | Validate the existence of XLink properties for arcs
@param SimpleXMLElement $xlinkAttributes
@param string $linkbase
@return boolean | [
"Validate",
"the",
"existence",
"of",
"XLink",
"properties",
"for",
"arcs"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L13549-L13574 | train |
bseddon/XBRL | XBRL.php | XBRL.validateLegalAttributes | public function validateLegalAttributes( $node )
{
if ( ! XBRL::isValidating() ) return true;
// Tuple elements should not have attributes from XBRL namespaces
$illegalAttributes = array();
foreach ( XBRL_Constants::$standardPrefixes as $prefix => $namespace )
{
if ( $prefix == STANDARD_PREFIX_SCHEMA ) continue;
if ( $prefix == STANDARD_PREFIX_SCHEMA_INSTANCE ) continue;
foreach ( $node->attributes( $namespace ) as $key => $attribute )
{
$illegalAttributes[] = $prefix . ":" . $attribute->getName();
}
}
if ( $illegalAttributes )
{
$this->log()->taxonomy_validation( "4.9", "Attributes assigned to tuples should not be ones defined in XBRL specification namespaces",
array(
'name' => $node->getName(),
'attributes' => "'" . join( ', ', $illegalAttributes ) . "'",
)
);
return true;
}
return false;
} | php | public function validateLegalAttributes( $node )
{
if ( ! XBRL::isValidating() ) return true;
// Tuple elements should not have attributes from XBRL namespaces
$illegalAttributes = array();
foreach ( XBRL_Constants::$standardPrefixes as $prefix => $namespace )
{
if ( $prefix == STANDARD_PREFIX_SCHEMA ) continue;
if ( $prefix == STANDARD_PREFIX_SCHEMA_INSTANCE ) continue;
foreach ( $node->attributes( $namespace ) as $key => $attribute )
{
$illegalAttributes[] = $prefix . ":" . $attribute->getName();
}
}
if ( $illegalAttributes )
{
$this->log()->taxonomy_validation( "4.9", "Attributes assigned to tuples should not be ones defined in XBRL specification namespaces",
array(
'name' => $node->getName(),
'attributes' => "'" . join( ', ', $illegalAttributes ) . "'",
)
);
return true;
}
return false;
} | [
"public",
"function",
"validateLegalAttributes",
"(",
"$",
"node",
")",
"{",
"if",
"(",
"!",
"XBRL",
"::",
"isValidating",
"(",
")",
")",
"return",
"true",
";",
"// Tuple elements should not have attributes from XBRL namespaces\r",
"$",
"illegalAttributes",
"=",
"arra... | Check to confirm the node does not contain attributes defined by the XBRL specification
@param SimpleXMLElement $node
@return boolean | [
"Check",
"to",
"confirm",
"the",
"node",
"does",
"not",
"contain",
"attributes",
"defined",
"by",
"the",
"XBRL",
"specification"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L13721-L13751 | train |
bseddon/XBRL | XBRL.php | XBRL.getCompleteDescendantElement | private function getCompleteDescendantElement( $element, $types )
{
$ancestor = $this->getAncestorElement( $element, $types );
if ( ! $ancestor )
{
if ( XBRL::isValidating() )
{
$this->log()->taxonomy_validation( "5.1", "Unable to locate the ancestor element for the derived element",
array(
'concept' => $name,
)
);
}
return $element;
}
else
{
if ( XBRL_Instance::isEmpty( $element, 'type' ) ) unset( $element['type'] );
if ( XBRL_Instance::isEmpty( $element, 'substitutionGroup' ) ) unset( $element['substitutionGroup'] );
return array_merge( $ancestor, $element );
}
} | php | private function getCompleteDescendantElement( $element, $types )
{
$ancestor = $this->getAncestorElement( $element, $types );
if ( ! $ancestor )
{
if ( XBRL::isValidating() )
{
$this->log()->taxonomy_validation( "5.1", "Unable to locate the ancestor element for the derived element",
array(
'concept' => $name,
)
);
}
return $element;
}
else
{
if ( XBRL_Instance::isEmpty( $element, 'type' ) ) unset( $element['type'] );
if ( XBRL_Instance::isEmpty( $element, 'substitutionGroup' ) ) unset( $element['substitutionGroup'] );
return array_merge( $ancestor, $element );
}
} | [
"private",
"function",
"getCompleteDescendantElement",
"(",
"$",
"element",
",",
"$",
"types",
")",
"{",
"$",
"ancestor",
"=",
"$",
"this",
"->",
"getAncestorElement",
"(",
"$",
"element",
",",
"$",
"types",
")",
";",
"if",
"(",
"!",
"$",
"ancestor",
")"... | Return an element with attributes updated if necessary
@param array $element An array representing the current item
@param XBRL_Types $types A reference to the current types
@return array Either the descendant array with any missing pieces or the descendant array unchanged | [
"Return",
"an",
"element",
"with",
"attributes",
"updated",
"if",
"necessary"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L14735-L14756 | train |
bseddon/XBRL | XBRL.php | XBRL.generateAllDRSs | public function generateAllDRSs()
{
$primaryItems = $this->getDefinitionPrimaryItems( true );
foreach ( $primaryItems as $primaryItemKey => $primaryItem )
{
$this->getPrimaryItemDRS( $primaryItem );
}
} | php | public function generateAllDRSs()
{
$primaryItems = $this->getDefinitionPrimaryItems( true );
foreach ( $primaryItems as $primaryItemKey => $primaryItem )
{
$this->getPrimaryItemDRS( $primaryItem );
}
} | [
"public",
"function",
"generateAllDRSs",
"(",
")",
"{",
"$",
"primaryItems",
"=",
"$",
"this",
"->",
"getDefinitionPrimaryItems",
"(",
"true",
")",
";",
"foreach",
"(",
"$",
"primaryItems",
"as",
"$",
"primaryItemKey",
"=>",
"$",
"primaryItem",
")",
"{",
"$"... | Process all the primary items to generate dimensional relationship sets | [
"Process",
"all",
"the",
"primary",
"items",
"to",
"generate",
"dimensional",
"relationship",
"sets"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L15894-L15901 | train |
bseddon/XBRL | XBRL.php | XBRL.getPrimaryItemDRS | public function getPrimaryItemDRS( $primaryItem )
{
$result = array();
foreach ( $primaryItem['roles'] as $roleUri )
{
// $result = array_merge( $result, $this->getPrimaryItemDRSForRole( $primaryItem, $roleUri ) );
$roleResult = $this->getPrimaryItemDRSForRole( $primaryItem, $roleUri );
foreach ( $roleResult as $hypercubeId => $roleHypercube )
{
if ( ! isset( $result[ $hypercubeId ] ) )
{
$result[ $hypercubeId ] = $roleHypercube;
continue;
}
foreach ( $roleHypercube as $role => $hypercube )
{
$result[ $hypercubeId ][ $role ] = $hypercube;
}
}
}
return $result;
} | php | public function getPrimaryItemDRS( $primaryItem )
{
$result = array();
foreach ( $primaryItem['roles'] as $roleUri )
{
// $result = array_merge( $result, $this->getPrimaryItemDRSForRole( $primaryItem, $roleUri ) );
$roleResult = $this->getPrimaryItemDRSForRole( $primaryItem, $roleUri );
foreach ( $roleResult as $hypercubeId => $roleHypercube )
{
if ( ! isset( $result[ $hypercubeId ] ) )
{
$result[ $hypercubeId ] = $roleHypercube;
continue;
}
foreach ( $roleHypercube as $role => $hypercube )
{
$result[ $hypercubeId ][ $role ] = $hypercube;
}
}
}
return $result;
} | [
"public",
"function",
"getPrimaryItemDRS",
"(",
"$",
"primaryItem",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"primaryItem",
"[",
"'roles'",
"]",
"as",
"$",
"roleUri",
")",
"{",
"// $result = array_merge( $result, $this->getPrima... | Create DRSs for a primary item across all its roles
@param array $primaryItem An array of elements which are the roles in which the primary item appears.
The array also includes an element 'roles' which is a list of all the roles.
@return array An array of hypercubes of the form [ $hypercubeId ][ $roleUri ][] | [
"Create",
"DRSs",
"for",
"a",
"primary",
"item",
"across",
"all",
"its",
"roles"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L15915-L15940 | train |
bseddon/XBRL | XBRL.php | XBRL.getPrimaryItemDRSForRole | private function getPrimaryItemDRSForRole( $primaryItem, $roleUri )
{
if ( ! isset( $primaryItem[ $roleUri ] ) )
{
$this->log()->warning( "The role '$roleUri' does not exist in the requested primary item" );
return array();
}
// Nothing to do if there are no hypercubes for the primary item
if ( !isset( $primaryItem[ $roleUri ]['hypercubes'] ) || ! count( $primaryItem[ $roleUri ]['hypercubes'] ) )
{
return array();
}
$role = $this->getDefinitionRoleRef( $roleUri );
if ( ! $role )
{
return array();
}
$primaryItemId = $primaryItem[ $roleUri ]['label'];
$result = array();
foreach ( $primaryItem[ $roleUri ]['hypercubes'] as $hypercubeId )
{
if ( ! $this->resolvePrimaryItemHypercubeDRS( $primaryItemId, $hypercubeId, $role ) )
{
// Something went wrong
continue;
}
if ( ! isset( $this->resolvedDRSCache[ $roleUri ][ $hypercubeId ] ) )
{
// Probably not good
continue;
}
$result[ $hypercubeId ][ $roleUri ] = $this->resolvedDRSCache[ $roleUri ][ $hypercubeId ];
}
return $result;
} | php | private function getPrimaryItemDRSForRole( $primaryItem, $roleUri )
{
if ( ! isset( $primaryItem[ $roleUri ] ) )
{
$this->log()->warning( "The role '$roleUri' does not exist in the requested primary item" );
return array();
}
// Nothing to do if there are no hypercubes for the primary item
if ( !isset( $primaryItem[ $roleUri ]['hypercubes'] ) || ! count( $primaryItem[ $roleUri ]['hypercubes'] ) )
{
return array();
}
$role = $this->getDefinitionRoleRef( $roleUri );
if ( ! $role )
{
return array();
}
$primaryItemId = $primaryItem[ $roleUri ]['label'];
$result = array();
foreach ( $primaryItem[ $roleUri ]['hypercubes'] as $hypercubeId )
{
if ( ! $this->resolvePrimaryItemHypercubeDRS( $primaryItemId, $hypercubeId, $role ) )
{
// Something went wrong
continue;
}
if ( ! isset( $this->resolvedDRSCache[ $roleUri ][ $hypercubeId ] ) )
{
// Probably not good
continue;
}
$result[ $hypercubeId ][ $roleUri ] = $this->resolvedDRSCache[ $roleUri ][ $hypercubeId ];
}
return $result;
} | [
"private",
"function",
"getPrimaryItemDRSForRole",
"(",
"$",
"primaryItem",
",",
"$",
"roleUri",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"primaryItem",
"[",
"$",
"roleUri",
"]",
")",
")",
"{",
"$",
"this",
"->",
"log",
"(",
")",
"->",
"warning",
... | Called by getPrimaryItemDRS to retreive the DRS for a specific primary item in a specific role
@param array $primaryItem
@param string $roleUri
@return mixed | [
"Called",
"by",
"getPrimaryItemDRS",
"to",
"retreive",
"the",
"DRS",
"for",
"a",
"specific",
"primary",
"item",
"in",
"a",
"specific",
"role"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L15948-L15990 | train |
bseddon/XBRL | XBRL.php | XBRL.promoteToPrimaryItem | private function promoteToPrimaryItem( $memberId, $parentId, &$newPrimaryItems, &$targetMembers, $targetRoleUri )
{
// Might have been promoted already because its also a child of another member
if ( ! isset( $targetMembers[ $memberId ] ) ) return;
if ( ! $parentId ) $parentId = $memberId;
// Might already exist as a primary item
if ( isset( $newPrimaryItems[ $memberId ] ) )
{
// In which case add a parent reference
if ( $parentId != $memberId )
{
$newPrimaryItems[ $memberId ]['parents'][ $parentId ] = $targetMembers[ $memberId ]['parents'][ $parentId ];
}
$newPrimaryItems[ $memberId ]['roleUri'] = $targetRoleUri;
return;
}
if ( ! isset( $newPrimaryItems[ $parentId ] ) )
{
XBRL_Log::getInstance()->warning( "Error trying to promote a member '$memberId' to primary item." );
return;
}
$newPrimaryItems[ $memberId ] = array(
'arcrole' => $targetMembers[ $memberId ]['parents'][ $parentId ]['arcrole'],
'hypercubes' => array(), // $newPrimaryItems[ $parentId ]['hypercubes'],
'parents' => array(
$parentId => $targetMembers[ $memberId ]['parents'][ $parentId ],
),
'roleUri' => $targetRoleUri,
);
} | php | private function promoteToPrimaryItem( $memberId, $parentId, &$newPrimaryItems, &$targetMembers, $targetRoleUri )
{
// Might have been promoted already because its also a child of another member
if ( ! isset( $targetMembers[ $memberId ] ) ) return;
if ( ! $parentId ) $parentId = $memberId;
// Might already exist as a primary item
if ( isset( $newPrimaryItems[ $memberId ] ) )
{
// In which case add a parent reference
if ( $parentId != $memberId )
{
$newPrimaryItems[ $memberId ]['parents'][ $parentId ] = $targetMembers[ $memberId ]['parents'][ $parentId ];
}
$newPrimaryItems[ $memberId ]['roleUri'] = $targetRoleUri;
return;
}
if ( ! isset( $newPrimaryItems[ $parentId ] ) )
{
XBRL_Log::getInstance()->warning( "Error trying to promote a member '$memberId' to primary item." );
return;
}
$newPrimaryItems[ $memberId ] = array(
'arcrole' => $targetMembers[ $memberId ]['parents'][ $parentId ]['arcrole'],
'hypercubes' => array(), // $newPrimaryItems[ $parentId ]['hypercubes'],
'parents' => array(
$parentId => $targetMembers[ $memberId ]['parents'][ $parentId ],
),
'roleUri' => $targetRoleUri,
);
} | [
"private",
"function",
"promoteToPrimaryItem",
"(",
"$",
"memberId",
",",
"$",
"parentId",
",",
"&",
"$",
"newPrimaryItems",
",",
"&",
"$",
"targetMembers",
",",
"$",
"targetRoleUri",
")",
"{",
"// Might have been promoted already because its also a child of another membe... | Converts a member definition in a target role into a primary item definition in a new role
@param string $memberId The id of the member to be promoted
@param string $parentId The id of the member's parent. May be 'false' if the member and parent ids are the same
@param array $newPrimaryItems An array of elements representing the new role being created
@param array $targetMembers An array of elements representing the role being merged
@param array $targetRoleUri The uri of the target role | [
"Converts",
"a",
"member",
"definition",
"in",
"a",
"target",
"role",
"into",
"a",
"primary",
"item",
"definition",
"in",
"a",
"new",
"role"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L16390-L16423 | train |
bseddon/XBRL | XBRL.php | XBRL.validateAppInfo | private function validateAppInfo()
{
$nodes = $this->xbrlDocument->children( XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_SCHEMA ] );
if ( property_exists( $nodes, 'annotation' ) )
{
$annotations = $nodes->annotation;
foreach ( $annotations as $annotationKey => $annotation )
{
if ( property_exists( $annotation, 'appinfo' ) )
{
/**
* @var SchemaTypes $types
*/
$types = XBRL_Types::getInstance();
$domNode = dom_import_simplexml( $annotation->appinfo );
foreach( $domNode->childNodes as $element => /** @var DOMNode $node */ $node )
{
if ( $node->nodeType != XML_ELEMENT_NODE ) continue;
if ( $node->localName == 'linkbase' )
{
$this->validateLinkbase( $node );
continue;
}
// If there is no type then ignore the element
$tax = $this->getTaxonomyForNamespace( $node->namespaceURI );
// Non-existant or built-in ones like 'linkbase' will not return a taxonomy
if ( ! $tax ) continue;
$prefix = $tax->getPrefix();
if ( ! ( $elementType = $types->getElement( $node->localName, $prefix ) ) ) continue;
if ( ! isset( $elementType['types'][0] ) ) continue;
// Check to see if the element type resolves to a decimal (such as an integer)
if ( ! $types->resolvesToBaseType( $elementType['types'][0], array( 'xs:decimal' ) ) ) continue;
// If it does, can the value be coerced to a numeric?
if ( is_numeric( $node->nodeValue ) ) continue;
$this->log()->taxonomy_validation( "4.9", "Element value type mismatch",
array(
'element' => $node->tagName,
'value' => $node->nodeValue
)
);
}
}
}
}
} | php | private function validateAppInfo()
{
$nodes = $this->xbrlDocument->children( XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_SCHEMA ] );
if ( property_exists( $nodes, 'annotation' ) )
{
$annotations = $nodes->annotation;
foreach ( $annotations as $annotationKey => $annotation )
{
if ( property_exists( $annotation, 'appinfo' ) )
{
/**
* @var SchemaTypes $types
*/
$types = XBRL_Types::getInstance();
$domNode = dom_import_simplexml( $annotation->appinfo );
foreach( $domNode->childNodes as $element => /** @var DOMNode $node */ $node )
{
if ( $node->nodeType != XML_ELEMENT_NODE ) continue;
if ( $node->localName == 'linkbase' )
{
$this->validateLinkbase( $node );
continue;
}
// If there is no type then ignore the element
$tax = $this->getTaxonomyForNamespace( $node->namespaceURI );
// Non-existant or built-in ones like 'linkbase' will not return a taxonomy
if ( ! $tax ) continue;
$prefix = $tax->getPrefix();
if ( ! ( $elementType = $types->getElement( $node->localName, $prefix ) ) ) continue;
if ( ! isset( $elementType['types'][0] ) ) continue;
// Check to see if the element type resolves to a decimal (such as an integer)
if ( ! $types->resolvesToBaseType( $elementType['types'][0], array( 'xs:decimal' ) ) ) continue;
// If it does, can the value be coerced to a numeric?
if ( is_numeric( $node->nodeValue ) ) continue;
$this->log()->taxonomy_validation( "4.9", "Element value type mismatch",
array(
'element' => $node->tagName,
'value' => $node->nodeValue
)
);
}
}
}
}
} | [
"private",
"function",
"validateAppInfo",
"(",
")",
"{",
"$",
"nodes",
"=",
"$",
"this",
"->",
"xbrlDocument",
"->",
"children",
"(",
"XBRL_Constants",
"::",
"$",
"standardPrefixes",
"[",
"STANDARD_PREFIX_SCHEMA",
"]",
")",
";",
"if",
"(",
"property_exists",
"... | Lax validation of the elements in the appinfo element | [
"Lax",
"validation",
"of",
"the",
"elements",
"in",
"the",
"appinfo",
"element"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L16844-L16894 | train |
bseddon/XBRL | XBRL.php | XBRL.addLinkbaseRef | public function addLinkbaseRef( $href, $title, $type = "simple", $role = "http://www.xbrl.org/2003/role/definitionLinkbaseRef", $arcrole="http://www.w3.org/1999/xlink/properties/linkbase", $base = "" )
{
$linkbaseRef = array(
'type' => $type,
'href' => XBRL::resolve_path( $this->schemaLocation, $href ),
'role' => $role,
'arcrole' => $arcrole,
'title' => $title,
'base' => $base,
);
$this->linkbaseTypes[ $role ][] = $linkbaseRef;
$this->loadSuccess = false;
$this->linkbasesProcessed = false;
switch ( $role )
{
case XBRL_Constants::$PresentationLinkbaseRef:
// $this->processPresentationLinkbases( $this->linkbaseTypes[ $role ] );
$this->processPresentationLinkbase( $linkbaseRef );
break;
case XBRL_Constants::$LabelLinkbaseRef:
// $this->processLabelLinkbases( $this->linkbaseTypes[ $role ] );
$this->processLabelLinkbase( $linkbaseRef );
break;
case XBRL_Constants::$DefinitionLinkbaseRef:
// $this->processDefinitionLinkbases( $this->linkbaseTypes[ $role ] );
$this->processDefinitionLinkbase( $linkbaseRef );
break;
case XBRL_Constants::$CalculationLinkbaseRef:
// $this->processCalculationLinkbases( $this->linkbaseTypes[ $role ] );
$this->processCalculationLinkbase( $linkbaseRef );
break;
case XBRL_Constants::$ReferenceLinkbaseRef:
// $this->processReferenceLinkbases( $linkbaseType );
$this->processReferenceLinkbase( $linkbaseRef );
break;
default:
// Handle custom linkbases
$this->processCustomLinkbases( $this->linkbaseTypes[ $role ] );
break;
}
$this->fixupDefinitionRoles(); // Mainly adds a 'paths' index to the 'hierarchy' element of each role.
$this->linkbasesProcessed = true;
$this->linkbasesProcessInProgress = false;
if ( $this->xbrlDocument )
{
$this->validateTaxonomy21();
}
// BMS 2018-05-03 Changed pass 'true' because without it the directed cycle validation tests are not performed
$this->validateDimensions( true );
$this->validateCustom();
$this->loadSuccess = true;
} | php | public function addLinkbaseRef( $href, $title, $type = "simple", $role = "http://www.xbrl.org/2003/role/definitionLinkbaseRef", $arcrole="http://www.w3.org/1999/xlink/properties/linkbase", $base = "" )
{
$linkbaseRef = array(
'type' => $type,
'href' => XBRL::resolve_path( $this->schemaLocation, $href ),
'role' => $role,
'arcrole' => $arcrole,
'title' => $title,
'base' => $base,
);
$this->linkbaseTypes[ $role ][] = $linkbaseRef;
$this->loadSuccess = false;
$this->linkbasesProcessed = false;
switch ( $role )
{
case XBRL_Constants::$PresentationLinkbaseRef:
// $this->processPresentationLinkbases( $this->linkbaseTypes[ $role ] );
$this->processPresentationLinkbase( $linkbaseRef );
break;
case XBRL_Constants::$LabelLinkbaseRef:
// $this->processLabelLinkbases( $this->linkbaseTypes[ $role ] );
$this->processLabelLinkbase( $linkbaseRef );
break;
case XBRL_Constants::$DefinitionLinkbaseRef:
// $this->processDefinitionLinkbases( $this->linkbaseTypes[ $role ] );
$this->processDefinitionLinkbase( $linkbaseRef );
break;
case XBRL_Constants::$CalculationLinkbaseRef:
// $this->processCalculationLinkbases( $this->linkbaseTypes[ $role ] );
$this->processCalculationLinkbase( $linkbaseRef );
break;
case XBRL_Constants::$ReferenceLinkbaseRef:
// $this->processReferenceLinkbases( $linkbaseType );
$this->processReferenceLinkbase( $linkbaseRef );
break;
default:
// Handle custom linkbases
$this->processCustomLinkbases( $this->linkbaseTypes[ $role ] );
break;
}
$this->fixupDefinitionRoles(); // Mainly adds a 'paths' index to the 'hierarchy' element of each role.
$this->linkbasesProcessed = true;
$this->linkbasesProcessInProgress = false;
if ( $this->xbrlDocument )
{
$this->validateTaxonomy21();
}
// BMS 2018-05-03 Changed pass 'true' because without it the directed cycle validation tests are not performed
$this->validateDimensions( true );
$this->validateCustom();
$this->loadSuccess = true;
} | [
"public",
"function",
"addLinkbaseRef",
"(",
"$",
"href",
",",
"$",
"title",
",",
"$",
"type",
"=",
"\"simple\"",
",",
"$",
"role",
"=",
"\"http://www.xbrl.org/2003/role/definitionLinkbaseRef\"",
",",
"$",
"arcrole",
"=",
"\"http://www.w3.org/1999/xlink/properties/linkb... | This function is to support the conformance suites. Some test creators have been lazy
in my view by creating one schema document that is to be use in multiple test where
each test has a different linkbase file. Instead of create a clone of the core schema
and adding relevant linkbase reference they use the testcase instructions to load a
linkbase.
@param string $href The linkbase file to load
@param string $title The title to use
@param string $type (default: simple)
@param string $role (default: http://www.xbrl.org/2003/role/definitionLinkbaseRef)
@param string $arcrole (default: http://www.w3.org/1999/xlink/properties/linkbase)
@param string $base (default: ) | [
"This",
"function",
"is",
"to",
"support",
"the",
"conformance",
"suites",
".",
"Some",
"test",
"creators",
"have",
"been",
"lazy",
"in",
"my",
"view",
"by",
"creating",
"one",
"schema",
"document",
"that",
"is",
"to",
"be",
"use",
"in",
"multiple",
"test"... | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L17472-L17536 | train |
bseddon/XBRL | XBRL.php | XBRL.importSchema | protected function importSchema( $schemaLocation, $depth = 0, $mainSchema = false )
{
$xbrlDocument = XBRL::getXml( $schemaLocation, $this->context );
if ( $xbrlDocument === null )
{
$this->log()->taxonomy_validation( "schema", "Unable to load taxonomy file ",
array(
'xsd' => "'$schemaLocation '",
)
);
return;
}
$namespace = (string) $xbrlDocument['targetNamespace'];
$classname = XBRL::class_from_namespace( $namespace );
/**
* @var XBRL $xbrl
*/
$xbrl = new $classname();
$xbrl->context =& $this->context;
// if ( $mainSchema )
// {
// $xbrl->context->setIsExtensionTaxonomy();
// $xbrl->context->types->clearElements();
// }
// $taxonomy = $xbrl->loadTaxonomy( $schemaLocation, $xbrlDocument, $namespace, $depth + 1 );
$taxonomy = $xbrl->loadSchema( $schemaLocation, $xbrlDocument, $namespace, $depth + 1 );
if ( ! $taxonomy )
{
$this->log()->warning( "Unable to create taxonomy from schema file '$schemaLocation'" );
return;
}
$this->importedFiles[] = $schemaLocation;
$namespace = $taxonomy->getNamespace();
// if ( $mainSchema ) $this->namespace = $namespace;
} | php | protected function importSchema( $schemaLocation, $depth = 0, $mainSchema = false )
{
$xbrlDocument = XBRL::getXml( $schemaLocation, $this->context );
if ( $xbrlDocument === null )
{
$this->log()->taxonomy_validation( "schema", "Unable to load taxonomy file ",
array(
'xsd' => "'$schemaLocation '",
)
);
return;
}
$namespace = (string) $xbrlDocument['targetNamespace'];
$classname = XBRL::class_from_namespace( $namespace );
/**
* @var XBRL $xbrl
*/
$xbrl = new $classname();
$xbrl->context =& $this->context;
// if ( $mainSchema )
// {
// $xbrl->context->setIsExtensionTaxonomy();
// $xbrl->context->types->clearElements();
// }
// $taxonomy = $xbrl->loadTaxonomy( $schemaLocation, $xbrlDocument, $namespace, $depth + 1 );
$taxonomy = $xbrl->loadSchema( $schemaLocation, $xbrlDocument, $namespace, $depth + 1 );
if ( ! $taxonomy )
{
$this->log()->warning( "Unable to create taxonomy from schema file '$schemaLocation'" );
return;
}
$this->importedFiles[] = $schemaLocation;
$namespace = $taxonomy->getNamespace();
// if ( $mainSchema ) $this->namespace = $namespace;
} | [
"protected",
"function",
"importSchema",
"(",
"$",
"schemaLocation",
",",
"$",
"depth",
"=",
"0",
",",
"$",
"mainSchema",
"=",
"false",
")",
"{",
"$",
"xbrlDocument",
"=",
"XBRL",
"::",
"getXml",
"(",
"$",
"schemaLocation",
",",
"$",
"this",
"->",
"conte... | Import a specific schema
@param string $schemaLocation The filename of the schema to load
@param int $depth The depth of this schema in the net be processed
@param bool $mainSchema If true the namespace of the imported schema will become the main schema of the object.
This is useful for extension taxonomies.
@return void | [
"Import",
"a",
"specific",
"schema"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L17624-L17661 | train |
bseddon/XBRL | XBRL.php | XBRL.includeSchemas | private function includeSchemas( $taxonomy_schema, $xmlDocument, $targetNamespace, $depth )
{
$includes = $xmlDocument->children( "http://www.w3.org/2001/XMLSchema" )->include;
if ( ! $includes ) return false;
$basenames = array();
foreach ( $includes as $key => $include )
{
if ( ! property_exists( $include->attributes(), 'schemaLocation' ) ) continue;
$basename = basename( (string) $include->attributes()->schemaLocation );
$basenames[] = $basename;
$includeFile = XBRL::resolve_path( $taxonomy_schema, (string) $include->attributes()->schemaLocation );
$includeDocument = $this->getXml( $includeFile, $this->context );
// Check the file exists
if ( ! $includeDocument )
{
if ( XBRL::isValidating() )
$this->log()->taxonomy_validation( "5.1", "The xml schema document referenced in the 'include' tag is not valid",
array(
'include' => "'$basename'",
)
);
return null;
}
// Check the target namespace is the same if one is provided
$namespace = (string) $includeDocument['targetNamespace'];
if ( ! empty( $namespace ) && $namespace != $targetNamespace )
{
if ( XBRL::isValidating() )
$this->log()->taxonomy_validation( "5.1", "The namespace of the schema file to include is not the same as that if the main schema file",
array(
'expected' => "'$targetNamespace'",
'actual' => "'$namespace'",
)
);
return null;
}
$this->includedFiles[] = $includeFile;
$this->context->schemaFileToNamespace[ $includeFile ] = $targetNamespace;
$this->context->schemaFileToNamespace[ basename( $includeFile ) ] = $targetNamespace;
// Note the use of the schemaLocation variable of *$this* because the component of the
// included file are really being added to the current schema.
$this->including = true;
// $taxonomy = $this->loadSchema( $this->schemaLocation, $includeDocument, $targetNamespace, $depth + 1 );
$taxonomy = $this->loadSchema( $includeFile, $includeDocument, $targetNamespace, $depth + 1 );
$this->including = false;
}
return true;
} | php | private function includeSchemas( $taxonomy_schema, $xmlDocument, $targetNamespace, $depth )
{
$includes = $xmlDocument->children( "http://www.w3.org/2001/XMLSchema" )->include;
if ( ! $includes ) return false;
$basenames = array();
foreach ( $includes as $key => $include )
{
if ( ! property_exists( $include->attributes(), 'schemaLocation' ) ) continue;
$basename = basename( (string) $include->attributes()->schemaLocation );
$basenames[] = $basename;
$includeFile = XBRL::resolve_path( $taxonomy_schema, (string) $include->attributes()->schemaLocation );
$includeDocument = $this->getXml( $includeFile, $this->context );
// Check the file exists
if ( ! $includeDocument )
{
if ( XBRL::isValidating() )
$this->log()->taxonomy_validation( "5.1", "The xml schema document referenced in the 'include' tag is not valid",
array(
'include' => "'$basename'",
)
);
return null;
}
// Check the target namespace is the same if one is provided
$namespace = (string) $includeDocument['targetNamespace'];
if ( ! empty( $namespace ) && $namespace != $targetNamespace )
{
if ( XBRL::isValidating() )
$this->log()->taxonomy_validation( "5.1", "The namespace of the schema file to include is not the same as that if the main schema file",
array(
'expected' => "'$targetNamespace'",
'actual' => "'$namespace'",
)
);
return null;
}
$this->includedFiles[] = $includeFile;
$this->context->schemaFileToNamespace[ $includeFile ] = $targetNamespace;
$this->context->schemaFileToNamespace[ basename( $includeFile ) ] = $targetNamespace;
// Note the use of the schemaLocation variable of *$this* because the component of the
// included file are really being added to the current schema.
$this->including = true;
// $taxonomy = $this->loadSchema( $this->schemaLocation, $includeDocument, $targetNamespace, $depth + 1 );
$taxonomy = $this->loadSchema( $includeFile, $includeDocument, $targetNamespace, $depth + 1 );
$this->including = false;
}
return true;
} | [
"private",
"function",
"includeSchemas",
"(",
"$",
"taxonomy_schema",
",",
"$",
"xmlDocument",
",",
"$",
"targetNamespace",
",",
"$",
"depth",
")",
"{",
"$",
"includes",
"=",
"$",
"xmlDocument",
"->",
"children",
"(",
"\"http://www.w3.org/2001/XMLSchema\"",
")",
... | Includes the content of one schema inside another. Really the included file is
an addition to the parent schema so the file name will be the same and the
target namespace MUST be the same
@param string $taxonomy_schema The file containing the taxonomy xsd
@param SimpleXMLElement $xmlDocument
@param string $targetNamespace The namespace of the taxonomy being loaded
@param int $depth The nesting level of this call. Used to indent any echo'd output
@return SimpleXMLElement|null | [
"Includes",
"the",
"content",
"of",
"one",
"schema",
"inside",
"another",
".",
"Really",
"the",
"included",
"file",
"is",
"an",
"addition",
"to",
"the",
"parent",
"schema",
"so",
"the",
"file",
"name",
"will",
"be",
"the",
"same",
"and",
"the",
"target",
... | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L17680-L17736 | train |
bseddon/XBRL | XBRL.php | XBRL.get_schema_root | private static function get_schema_root( $file )
{
if ( filter_var( $file, FILTER_VALIDATE_URL ) === false )
{
// my else codes goes
if ( strtoupper( substr( PHP_OS, 0, 3 ) ) === 'WIN' )
{
// First case is c:\
if ( strlen( $file ) > 1 && substr( $file, 1, 1 ) === ":" )
$root = "{$file[0]}:";
// Second case is a volume
elseif ( strlen( $file ) > 1 && substr( $file, 0, 2 ) === "\\\\" )
{
$pos = strpos( $file, '\\', 2 );
if ( $pos === false )
$root = $file;
else
$root = substr( $file, 0, $pos );
}
// The catch all is that no root is provided
else
$root = pathinfo( $file, PATHINFO_EXTENSION ) === ""
? $file
: pathinfo( $file, PATHINFO_DIRNAME );
}
}
else
{
$components = parse_url( $file );
$root = "{$components['scheme']}://{$components['host']}";
}
return $root;
} | php | private static function get_schema_root( $file )
{
if ( filter_var( $file, FILTER_VALIDATE_URL ) === false )
{
// my else codes goes
if ( strtoupper( substr( PHP_OS, 0, 3 ) ) === 'WIN' )
{
// First case is c:\
if ( strlen( $file ) > 1 && substr( $file, 1, 1 ) === ":" )
$root = "{$file[0]}:";
// Second case is a volume
elseif ( strlen( $file ) > 1 && substr( $file, 0, 2 ) === "\\\\" )
{
$pos = strpos( $file, '\\', 2 );
if ( $pos === false )
$root = $file;
else
$root = substr( $file, 0, $pos );
}
// The catch all is that no root is provided
else
$root = pathinfo( $file, PATHINFO_EXTENSION ) === ""
? $file
: pathinfo( $file, PATHINFO_DIRNAME );
}
}
else
{
$components = parse_url( $file );
$root = "{$components['scheme']}://{$components['host']}";
}
return $root;
} | [
"private",
"static",
"function",
"get_schema_root",
"(",
"$",
"file",
")",
"{",
"if",
"(",
"filter_var",
"(",
"$",
"file",
",",
"FILTER_VALIDATE_URL",
")",
"===",
"false",
")",
"{",
"// my else codes goes\r",
"if",
"(",
"strtoupper",
"(",
"substr",
"(",
"PHP... | Used by resolve_path to obtain the root element of a uri or file path.
This is necessary because a schema or linkbase uri may be absolute but without a host.
@param string The file
@return string The root | [
"Used",
"by",
"resolve_path",
"to",
"obtain",
"the",
"root",
"element",
"of",
"a",
"uri",
"or",
"file",
"path",
".",
"This",
"is",
"necessary",
"because",
"a",
"schema",
"or",
"linkbase",
"uri",
"may",
"be",
"absolute",
"but",
"without",
"a",
"host",
"."... | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L17745-L17779 | train |
bseddon/XBRL | XBRL.php | XBRL.getXml | public static function getXml( $url, $context )
{
$xml = null;
$xml_string = XBRL::getXmlInner( $url, $context );
if ( $xml_string )
{
try
{
// Replace the handler because the status test handler traps any error and terminates the session
$previousHandler = set_error_handler(null);
$xml = @new SimpleXMLElement( $xml_string );
set_error_handler( $previousHandler );
}
catch( Exception $ex )
{
}
// Example using xpath
// $elements = $xml->xpath( "/default:schema/default:element[@name='AccountingPolicies']" );
if ( $xml !== null )
{
$ns = $xml->getDocNamespaces();
foreach ( $ns as $prefix => $namespace )
{
$xml->registerXPathNamespace( empty( $prefix ) ? "default" : $prefix, $namespace );
}
}
}
return $xml;
} | php | public static function getXml( $url, $context )
{
$xml = null;
$xml_string = XBRL::getXmlInner( $url, $context );
if ( $xml_string )
{
try
{
// Replace the handler because the status test handler traps any error and terminates the session
$previousHandler = set_error_handler(null);
$xml = @new SimpleXMLElement( $xml_string );
set_error_handler( $previousHandler );
}
catch( Exception $ex )
{
}
// Example using xpath
// $elements = $xml->xpath( "/default:schema/default:element[@name='AccountingPolicies']" );
if ( $xml !== null )
{
$ns = $xml->getDocNamespaces();
foreach ( $ns as $prefix => $namespace )
{
$xml->registerXPathNamespace( empty( $prefix ) ? "default" : $prefix, $namespace );
}
}
}
return $xml;
} | [
"public",
"static",
"function",
"getXml",
"(",
"$",
"url",
",",
"$",
"context",
")",
"{",
"$",
"xml",
"=",
"null",
";",
"$",
"xml_string",
"=",
"XBRL",
"::",
"getXmlInner",
"(",
"$",
"url",
",",
"$",
"context",
")",
";",
"if",
"(",
"$",
"xml_string... | Accesses and opens an xsd or xml file. If an http request and caching is enabled
the request will be serviced from the cache. If caching is enabled and the file
is an http request but no available in the cache it will be cached.
@param string $url The file to access. Assumes this is a fully qualified file.
@param XBRL_Global $context The singleton containing the global information
@returns A SimpleXMLElement instance or FALSE | [
"Accesses",
"and",
"opens",
"an",
"xsd",
"or",
"xml",
"file",
".",
"If",
"an",
"http",
"request",
"and",
"caching",
"is",
"enabled",
"the",
"request",
"will",
"be",
"serviced",
"from",
"the",
"cache",
".",
"If",
"caching",
"is",
"enabled",
"and",
"the",
... | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L17875-L17906 | train |
bseddon/XBRL | XBRL.php | XBRL.getXmlInner | public static function getXmlInner( $url, $context )
{
// In the future the urls of taxonomies may change. For example
// http://resources.companieshouse.gov.uk/ef/xbrl/gaap/gcd/2004-12-01/uk-gcd-2004-12-01.xsd
// now maps to:
// http://resources.companieshouse.gov.uk/ef/xbrl/gaap/gcd/2004-12-01/uk-gcd-2004-12-01.xsd
// This allows an application using this class to remap the address of a taxonomy.
// $mapUrl is a function that accepts one url parammeter and returns a url. If the function does
// not handle mapping for the url passed as an argument then it shoul return the passed url.
global $mapUrl;
if ( $mapUrl ) $url = $mapUrl( $url );
// If caching is not being used or the url is a local file get the file and return it
if ( ! $context->useCache || ! filter_var( $url, FILTER_VALIDATE_URL ) )
{
// Replace the handler because the status test handler traps any error and terminates the session
$previousHandler = set_error_handler(null);
$result = @file_get_contents( $url );
set_error_handler( $previousHandler );
return $result;
}
// Its an HTTP request so get it then cache it and update the map
$path = $context->findCachedFile( $url );
if ( $path !== false )
{
return @file_get_contents( $path );
}
else
{
// Get the file and store it updating the map
// Replace the handler because the status test handler traps any error and terminates the session
$previousHandler = set_error_handler(null);
$xml = @file_get_contents( $url );
set_error_handler( $previousHandler );
if ( $xml === false)
return null;
$context->saveCacheFile( $url, $xml );
return $xml;
}
} | php | public static function getXmlInner( $url, $context )
{
// In the future the urls of taxonomies may change. For example
// http://resources.companieshouse.gov.uk/ef/xbrl/gaap/gcd/2004-12-01/uk-gcd-2004-12-01.xsd
// now maps to:
// http://resources.companieshouse.gov.uk/ef/xbrl/gaap/gcd/2004-12-01/uk-gcd-2004-12-01.xsd
// This allows an application using this class to remap the address of a taxonomy.
// $mapUrl is a function that accepts one url parammeter and returns a url. If the function does
// not handle mapping for the url passed as an argument then it shoul return the passed url.
global $mapUrl;
if ( $mapUrl ) $url = $mapUrl( $url );
// If caching is not being used or the url is a local file get the file and return it
if ( ! $context->useCache || ! filter_var( $url, FILTER_VALIDATE_URL ) )
{
// Replace the handler because the status test handler traps any error and terminates the session
$previousHandler = set_error_handler(null);
$result = @file_get_contents( $url );
set_error_handler( $previousHandler );
return $result;
}
// Its an HTTP request so get it then cache it and update the map
$path = $context->findCachedFile( $url );
if ( $path !== false )
{
return @file_get_contents( $path );
}
else
{
// Get the file and store it updating the map
// Replace the handler because the status test handler traps any error and terminates the session
$previousHandler = set_error_handler(null);
$xml = @file_get_contents( $url );
set_error_handler( $previousHandler );
if ( $xml === false)
return null;
$context->saveCacheFile( $url, $xml );
return $xml;
}
} | [
"public",
"static",
"function",
"getXmlInner",
"(",
"$",
"url",
",",
"$",
"context",
")",
"{",
"// In the future the urls of taxonomies may change. For example\r",
"// \t\thttp://resources.companieshouse.gov.uk/ef/xbrl/gaap/gcd/2004-12-01/uk-gcd-2004-12-01.xsd\r",
"// now maps to:\r",
... | Get the XML for a resource
@param string url The file to access. Assumes this is a fully qualified file.
@param XBRL_Global $context The singleton containing the global information
@return string|boolean | [
"Get",
"the",
"XML",
"for",
"a",
"resource"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L17914-L17956 | train |
bseddon/XBRL | XBRL.php | XBRL.GUID | public static function GUID()
{
if ( function_exists( 'com_create_guid' ) === true )
{
return trim( com_create_guid(), '{}' );
}
return sprintf( '%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand( 0, 65535 ), mt_rand( 0, 65535 ), mt_rand( 0, 65535 ), mt_rand( 16384, 20479 ), mt_rand( 32768, 49151 ), mt_rand( 0, 65535 ), mt_rand( 0, 65535 ), mt_rand( 0, 65535 ) );
} | php | public static function GUID()
{
if ( function_exists( 'com_create_guid' ) === true )
{
return trim( com_create_guid(), '{}' );
}
return sprintf( '%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand( 0, 65535 ), mt_rand( 0, 65535 ), mt_rand( 0, 65535 ), mt_rand( 16384, 20479 ), mt_rand( 32768, 49151 ), mt_rand( 0, 65535 ), mt_rand( 0, 65535 ), mt_rand( 0, 65535 ) );
} | [
"public",
"static",
"function",
"GUID",
"(",
")",
"{",
"if",
"(",
"function_exists",
"(",
"'com_create_guid'",
")",
"===",
"true",
")",
"{",
"return",
"trim",
"(",
"com_create_guid",
"(",
")",
",",
"'{}'",
")",
";",
"}",
"return",
"sprintf",
"(",
"'%04X%... | Utility function to return a GUID. If on Windows it will use the PHP functon
com_create_guid otherwise is will use mt_rand to create a GUID of the form
'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
@return string | [
"Utility",
"function",
"to",
"return",
"a",
"GUID",
".",
"If",
"on",
"Windows",
"it",
"will",
"use",
"the",
"PHP",
"functon",
"com_create_guid",
"otherwise",
"is",
"will",
"use",
"mt_rand",
"to",
"create",
"a",
"GUID",
"of",
"the",
"form",
"XXXXXXXX",
"-",... | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L17964-L17972 | train |
bseddon/XBRL | XBRL.php | XBRL.array_flip2 | public static function array_flip2( $array )
{
$result = array();
foreach ( $array as $key => $value )
{
if ( isset( $result[ $value ] ) && in_array( $key, $result[ $value ] ) ) continue;
$result[ $value ][] = $key;
}
return $result;
} | php | public static function array_flip2( $array )
{
$result = array();
foreach ( $array as $key => $value )
{
if ( isset( $result[ $value ] ) && in_array( $key, $result[ $value ] ) ) continue;
$result[ $value ][] = $key;
}
return $result;
} | [
"public",
"static",
"function",
"array_flip2",
"(",
"$",
"array",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"result",
"[",
"$"... | Creates a flipped array but allows for the possibility that the same fragment can be referenced by more than one locator
@param array $array Array of locators
@return array | [
"Creates",
"a",
"flipped",
"array",
"but",
"allows",
"for",
"the",
"possibility",
"that",
"the",
"same",
"fragment",
"can",
"be",
"referenced",
"by",
"more",
"than",
"one",
"locator"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L18137-L18146 | train |
bseddon/XBRL | XBRL.php | XBRL.findDimensionMember | public static function findDimensionMember( $nodes, $label )
{
if ( isset( $nodes[ $label ] ) ) return $nodes[ $label ];
foreach ( $nodes as $nodeKey => $node )
{
if ( ! isset( $node['children'] ) ) continue;
$result = XBRL::findDimensionMember( $node['children'], $label );
if ( $result !== false ) return $result;
}
return false;
} | php | public static function findDimensionMember( $nodes, $label )
{
if ( isset( $nodes[ $label ] ) ) return $nodes[ $label ];
foreach ( $nodes as $nodeKey => $node )
{
if ( ! isset( $node['children'] ) ) continue;
$result = XBRL::findDimensionMember( $node['children'], $label );
if ( $result !== false ) return $result;
}
return false;
} | [
"public",
"static",
"function",
"findDimensionMember",
"(",
"$",
"nodes",
",",
"$",
"label",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"nodes",
"[",
"$",
"label",
"]",
")",
")",
"return",
"$",
"nodes",
"[",
"$",
"label",
"]",
";",
"foreach",
"(",
"$"... | Get the member corresponding to a member label. Dimension members are held in a hierarchical structure.
This function is able to find a member in such a structure.
@param array $nodes A collection of nodes prepresenting the member hierarchy of a hypercube dimension
@param string $label The label corresponding to a dimension member or dimension domain
@return array|boolean Return false if the member is not found or the member. | [
"Get",
"the",
"member",
"corresponding",
"to",
"a",
"member",
"label",
".",
"Dimension",
"members",
"are",
"held",
"in",
"a",
"hierarchical",
"structure",
".",
"This",
"function",
"is",
"able",
"to",
"find",
"a",
"member",
"in",
"such",
"a",
"structure",
"... | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L18155-L18167 | train |
bseddon/XBRL | XBRL.php | XBRL.equivalenceHash | private function equivalenceHash( $elementName, $linkName, $linkRole, $fromHref, $toHref, $order = 1, $weight = null, $preferredLabel = null )
{
if ( ! is_numeric( $order ) ) $order = null;
if ( ! is_numeric( $weight ) ) $weight = null;
return hash( "sha256", "$elementName-$linkName-$linkRole-$fromHref-$toHref-$order-$weight-$preferredLabel" );
} | php | private function equivalenceHash( $elementName, $linkName, $linkRole, $fromHref, $toHref, $order = 1, $weight = null, $preferredLabel = null )
{
if ( ! is_numeric( $order ) ) $order = null;
if ( ! is_numeric( $weight ) ) $weight = null;
return hash( "sha256", "$elementName-$linkName-$linkRole-$fromHref-$toHref-$order-$weight-$preferredLabel" );
} | [
"private",
"function",
"equivalenceHash",
"(",
"$",
"elementName",
",",
"$",
"linkName",
",",
"$",
"linkRole",
",",
"$",
"fromHref",
",",
"$",
"toHref",
",",
"$",
"order",
"=",
"1",
",",
"$",
"weight",
"=",
"null",
",",
"$",
"preferredLabel",
"=",
"nul... | Create a hash for an arc
@param string $elementName eg labelArc
@param string $linkName eg labelLink
@param string $linkRole eg http://www.xbrl.org/2003/role/link
@param string $fromHref The Href
@param string $toHref The Href
@param number $order eg 2 defaults to 1
@param number $weight eg 2 defaults to null
@param string $preferredLabel defaults to null
@return string | [
"Create",
"a",
"hash",
"for",
"an",
"arc"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL.php#L18211-L18217 | train |
bseddon/XBRL | Formulas/Exceptions/FormulasException.php | FormulasException.withType | public static function withType( $error, $formulaType, $message )
{
$ex = new FormulasException( $message );
$ex->formulaType = $formulaType;
$ex->error = $error;
return $ex;
} | php | public static function withType( $error, $formulaType, $message )
{
$ex = new FormulasException( $message );
$ex->formulaType = $formulaType;
$ex->error = $error;
return $ex;
} | [
"public",
"static",
"function",
"withType",
"(",
"$",
"error",
",",
"$",
"formulaType",
",",
"$",
"message",
")",
"{",
"$",
"ex",
"=",
"new",
"FormulasException",
"(",
"$",
"message",
")",
";",
"$",
"ex",
"->",
"formulaType",
"=",
"$",
"formulaType",
"... | Create an exception type with a formula type
@param string QName of the error code being reported
@param string $formulaType
@param string $message
@return \XBRL\Formulas\Resources\FormulasException | [
"Create",
"an",
"exception",
"type",
"with",
"a",
"formula",
"type"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/Formulas/Exceptions/FormulasException.php#L57-L64 | train |
bseddon/XBRL | XBRL-US-TaxonomyPackage.php | XBRL_US_TaxonomyPackage.saveTaxonomy | public function saveTaxonomy( $cacheLocation )
{
$entryPoints = $this->getSchemaEntryPoints();
$originalSchemaFile = $this->schemaFile;
$originalNamespace = $this->schemaNamespace;
$context = XBRL_Global::getInstance();
if ( ! $context->useCache )
{
$context->useCache = true;
$context->cacheLocation = $cacheLocation;
$context->initializeCache();
}
try
{
foreach ( $entryPoints as $index => $entryPoint )
{
if ( $context->findCachedFile( $entryPoint ) )
{
$this->errors[] = "The schema file '{$this->schemaFile}' already exists in the cache.";
continue;
}
// Get the namespace
$this->schemaFile = $entryPoint;
$this->schemaNamespace = null;
// Find the schema document
$content = trim( $this->getFile( $this->getActualUri( $this->schemaFile ) ) );
$result = $this->processSchemaDocument( $context, $content, false );
$this->setUrlMap();
if ( ! $result )
{
$this->errors[] = "Unable to process the schema document";
return false;
}
// Look for the non-schema file
$firstFolder = $this->getFirstFolderName();
$this->traverseContents( function( $path, $name, $type ) use( &$context, $firstFolder )
{
if ( $type == PATHINFO_DIRNAME ) return true;
$extension = pathinfo( $name, PATHINFO_EXTENSION );
if ( ! in_array( $extension, array( 'xml', 'xbrl', 'xsd' ) ) ) return true;
$path = $path ? "$path$name" : "$name";
$content = $this->getFile( $path );
if ( $firstFolder )
{
$path = preg_replace( "|^$firstFolder/|", '/us-gaap/' . $this->taxonomyYear . "/", $path );
}
$uri = XBRL::resolve_path( $this->schemaFile, $path ); // $common = $this->getCommonRootFolder( $path, $this->schemaFile );
if ( $context->findCachedFile( $uri ) ) return true;
$context->saveCacheFile( $uri, $content );
return true;
} );
}
}
catch( \Exception $ex )
{
$this->errors[] = $ex->getMessage();
}
finally
{
$this->schemaFile = $originalSchemaFile;
$this->schemaNamespace = $originalNamespace;
}
} | php | public function saveTaxonomy( $cacheLocation )
{
$entryPoints = $this->getSchemaEntryPoints();
$originalSchemaFile = $this->schemaFile;
$originalNamespace = $this->schemaNamespace;
$context = XBRL_Global::getInstance();
if ( ! $context->useCache )
{
$context->useCache = true;
$context->cacheLocation = $cacheLocation;
$context->initializeCache();
}
try
{
foreach ( $entryPoints as $index => $entryPoint )
{
if ( $context->findCachedFile( $entryPoint ) )
{
$this->errors[] = "The schema file '{$this->schemaFile}' already exists in the cache.";
continue;
}
// Get the namespace
$this->schemaFile = $entryPoint;
$this->schemaNamespace = null;
// Find the schema document
$content = trim( $this->getFile( $this->getActualUri( $this->schemaFile ) ) );
$result = $this->processSchemaDocument( $context, $content, false );
$this->setUrlMap();
if ( ! $result )
{
$this->errors[] = "Unable to process the schema document";
return false;
}
// Look for the non-schema file
$firstFolder = $this->getFirstFolderName();
$this->traverseContents( function( $path, $name, $type ) use( &$context, $firstFolder )
{
if ( $type == PATHINFO_DIRNAME ) return true;
$extension = pathinfo( $name, PATHINFO_EXTENSION );
if ( ! in_array( $extension, array( 'xml', 'xbrl', 'xsd' ) ) ) return true;
$path = $path ? "$path$name" : "$name";
$content = $this->getFile( $path );
if ( $firstFolder )
{
$path = preg_replace( "|^$firstFolder/|", '/us-gaap/' . $this->taxonomyYear . "/", $path );
}
$uri = XBRL::resolve_path( $this->schemaFile, $path ); // $common = $this->getCommonRootFolder( $path, $this->schemaFile );
if ( $context->findCachedFile( $uri ) ) return true;
$context->saveCacheFile( $uri, $content );
return true;
} );
}
}
catch( \Exception $ex )
{
$this->errors[] = $ex->getMessage();
}
finally
{
$this->schemaFile = $originalSchemaFile;
$this->schemaNamespace = $originalNamespace;
}
} | [
"public",
"function",
"saveTaxonomy",
"(",
"$",
"cacheLocation",
")",
"{",
"$",
"entryPoints",
"=",
"$",
"this",
"->",
"getSchemaEntryPoints",
"(",
")",
";",
"$",
"originalSchemaFile",
"=",
"$",
"this",
"->",
"schemaFile",
";",
"$",
"originalNamespace",
"=",
... | Save the taxonomy for all entry points | [
"Save",
"the",
"taxonomy",
"for",
"all",
"entry",
"points"
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL-US-TaxonomyPackage.php#L310-L379 | train |
bseddon/XBRL | XBRL-Log.php | XBRL_Log.err | public function err( $message )
{
$ex = new Exception();
echo $ex->getTraceAsString();
if ( ! $this->log ) return;
return $this->log->err( $message );
} | php | public function err( $message )
{
$ex = new Exception();
echo $ex->getTraceAsString();
if ( ! $this->log ) return;
return $this->log->err( $message );
} | [
"public",
"function",
"err",
"(",
"$",
"message",
")",
"{",
"$",
"ex",
"=",
"new",
"Exception",
"(",
")",
";",
"echo",
"$",
"ex",
"->",
"getTraceAsString",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"log",
")",
"return",
";",
"return",
"$"... | A convenience function for logging a error event. It will log a
message at the PEAR_LOG_ERR log level.
PEAR_LOG_ERR
@param mixed $message String or object containing the message to log.
@return boolean True if the message was successfully logged. | [
"A",
"convenience",
"function",
"for",
"logging",
"a",
"error",
"event",
".",
"It",
"will",
"log",
"a",
"message",
"at",
"the",
"PEAR_LOG_ERR",
"log",
"level",
"."
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL-Log.php#L218-L225 | train |
bseddon/XBRL | XBRL-Log.php | XBRL_Log.dimension_validation | public function dimension_validation( $section, $message, $source )
{
if ( ! $this->log ) return;
$this->conformanceIssueWarning = true;
$msg = sprintf( "[dimension] $message (Section %s - %s)", $section, $this->arrayToDescription( $source ) );
$this->log->_announce( array( 'section' => $section, 'priority' => PEAR_LOG_WARNING, 'message' => $message, 'source' => $source ) );
return $this->log->warning( $msg );
} | php | public function dimension_validation( $section, $message, $source )
{
if ( ! $this->log ) return;
$this->conformanceIssueWarning = true;
$msg = sprintf( "[dimension] $message (Section %s - %s)", $section, $this->arrayToDescription( $source ) );
$this->log->_announce( array( 'section' => $section, 'priority' => PEAR_LOG_WARNING, 'message' => $message, 'source' => $source ) );
return $this->log->warning( $msg );
} | [
"public",
"function",
"dimension_validation",
"(",
"$",
"section",
",",
"$",
"message",
",",
"$",
"source",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"log",
")",
"return",
";",
"$",
"this",
"->",
"conformanceIssueWarning",
"=",
"true",
";",
"$",
"ms... | A convenience function for logging a event about an XBRL dimensions specification conformance issue.
It will log a message at the PEAR_LOG_DEBUG log level.
PEAR_LOG_WARNING
@param string $section The specification section reference
@param string $message String or object containing the message to log.
@param array $source An array containing details about the source such as the element id, link base, etc.
@return boolean True if the message was successfully logged. | [
"A",
"convenience",
"function",
"for",
"logging",
"a",
"event",
"about",
"an",
"XBRL",
"dimensions",
"specification",
"conformance",
"issue",
".",
"It",
"will",
"log",
"a",
"message",
"at",
"the",
"PEAR_LOG_DEBUG",
"log",
"level",
"."
] | 6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94 | https://github.com/bseddon/XBRL/blob/6ffdcedd68b0a7957b2358bcec15b22bd4c5dc94/XBRL-Log.php#L298-L305 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.