idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
34,100
public function business_rules_validation ( $ section , $ message , $ source ) { if ( ! $ this -> log ) return ; $ this -> businessRulesViolationeWarning = true ; $ msg = sprintf ( "[business rules] $message (Section %s - %s)" , $ section , $ this -> arrayToDescription ( $ source ) ) ; $ this -> log -> _announce ( arra...
A convenience function for logging a event about an XBRL business rules violation issue . It will log a message at the PEAR_LOG_WARNING log level .
34,101
public function formula_validation ( $ section , $ message , $ source ) { if ( ! $ this -> log ) return ; $ this -> conformanceIssueWarning = true ; $ errorMessage = sprintf ( "[formula] $message (Section %s - %s)" , $ section , $ this -> arrayToDescription ( $ source ) ) ; $ this -> log -> _announce ( array ( 'section...
A convenience function for logging a event about an XBRL formula specification conformance issue . It will log a message at the PEAR_LOG_DEBUG log level .
34,102
public function formula_evaluation ( $ section , $ message , $ source ) { if ( ! $ this -> log ) return ; $ message = "$section $message" ; $ this -> log -> _announce ( array ( 'section' => $ section , 'priority' => PEAR_LOG_INFO , 'message' => $ message , 'source' => $ source ) ) ; $ this -> log -> info ( $ message ) ...
A convenience function for logging a formula evaluation result event . It will log a message at the PEAR_LOG_INFO log level .
34,103
public function instance_validation ( $ section , $ message , $ source ) { if ( ! $ this -> log ) return ; $ this -> instanceValidationWarning = true ; $ msg = sprintf ( "[instance] $message (Section %s - %s)" , $ section , $ this -> arrayToDescription ( $ source ) ) ; $ this -> log -> _announce ( array ( 'section' => ...
A convenience function for logging an event about an XBRL instance specification conformance issue . It will log a message at the PEAR_LOG_DEBUG log level .
34,104
public function conformance_issue ( $ testid , $ message , $ source ) { if ( ! $ this -> log ) return ; $ this -> conformanceIssueWarning = true ; return $ this -> log -> warning ( sprintf ( "[instance] $message (Section %s - %s)" , $ testid , $ this -> arrayToDescription ( $ source ) ) ) ; }
A convenience function for logging an event about an XBRL conformance test . It will log a message at the PEAR_LOG_DEBUG log level .
34,105
public function AddVariable ( & $ variable ) { $ qname = $ variable -> getQName ( ) -> clarkNotation ( ) ; if ( isset ( $ this -> variablesByQName [ $ qname ] ) ) { $ x = 1 ; \ XBRL_Log :: getInstance ( ) -> formula_validation ( "Variable-set" , "The variable name (defined on an arc) already exists" , array ( 'name' =>...
Add a variable check for duplicates and update the lable - > qname map
34,106
public function getParametersAsVars ( $ vars = array ( ) ) { foreach ( $ this -> parameters as $ qname => $ parameter ) { $ vars [ $ qname ] = $ parameter -> result ; } return $ vars ; }
Return an array of parameter values
34,107
public function getBindingsAsVars ( $ vars = array ( ) ) { $ vars = $ this -> getParametersAsVars ( $ vars ) ; foreach ( $ this -> factVariableBindings as $ bindingQName => $ varBinding ) { if ( $ varBinding -> isFallback ) { $ current = $ varBinding -> yieldedFact ; } else { if ( ! $ varBinding -> valid ( ) ) $ varBin...
Return an array of bound facts and parameters after the evaluation
34,108
public function getFactsWithNils ( ) { if ( $ this -> nilsFactsCache ) { return $ this -> nilsFactsCache ; } else { $ nilsFactsCacheExpression = "xfi:facts-in-instance(/xbrli:xbrl)" ; if ( ! is_null ( $ this -> groupFilterExpression ) ) { $ nilsFactsCacheExpression .= "[{$this->groupFilterExpression}]" ; } $ this -> ni...
Return a list of the input instance fact with nils
34,109
public function setFactsDimensions ( $ nils , $ dimensions ) { if ( $ nils ) $ this -> nilFactsDimensions = $ dimensions ; else $ this -> factsDimensions = $ dimensions ; }
Set a list of the dimensions across all dimensions
34,110
public function getFactsWithoutNils ( ) { if ( $ this -> nonNilsFactsCache ) { return $ this -> nonNilsFactsCache ; } else { $ nonNilsFactsCacheExpression = "xfi:non-nil-facts-in-instance(/xbrli:xbrl)" ; if ( ! is_null ( $ this -> groupFilterExpression ) ) { $ nonNilsFactsCacheExpression .= "[{$this->groupFilterExpress...
Return a list of the input instance fact withou nils
34,111
public function getVariableDetails ( $ variable , $ includePrefix = true ) { $ result = array ( 'value' => $ this -> valueToString ( $ variable , $ includePrefix ) ) ; if ( $ variable instanceof DOMXPathNavigator ) { $ result [ 'concept' ] = $ variable -> getName ( ) ; $ result [ 'context' ] = FactValues :: getContextR...
Returns a set of details for a fact
34,112
public function createDefaultMessage ( $ test , $ vars ) { $ substitutions = array ( ) ; foreach ( $ vars as $ name => $ var ) { if ( strpos ( $ test , "\$$name" ) === false ) continue ; $ substitutions [ $ name ] = Resource :: valueToString ( $ var ) ; } foreach ( $ substitutions as $ name => $ substitution ) { $ test...
Generates a default message based on the formula test
34,113
private function validateCommon ( $ taxonomy , $ contextParameters ) { if ( ! $ this -> validateCustomFunction ( $ taxonomy ) ) { return false ; } if ( ! $ this -> validateVariableSets ( $ taxonomy , $ contextParameters ) ) { return false ; } if ( ! $ this -> validateConsistencyAssertions ( $ taxonomy ) ) { return fals...
Process the validations common to all variable sets
34,114
private function addNamespaces ( $ additionalNamespaces ) { foreach ( $ additionalNamespaces as $ namespaces ) { if ( is_null ( $ namespaces ) || ! is_array ( $ namespaces ) ) { continue ; } foreach ( $ namespaces as $ prefix => $ namespace ) { if ( empty ( $ prefix ) ) continue ; $ this -> nsMgr -> addNamespace ( $ pr...
Creates a namespace manager for a formula processor
34,115
private function validateVariableScopes ( $ taxonomy , $ variableSetInstance ) { $ scopeArcs = $ taxonomy -> getGenericArc ( XBRL_Constants :: $ arcRoleVariablesScope , $ variableSetInstance -> extendedLinkRoleUri , null , $ variableSetInstance -> path , null , $ variableSetInstance -> linkbase ) ; if ( ! $ scopeArcs )...
Look for and validate any variable scope arcs
34,116
private function validateLabels ( $ taxonomy , $ target , $ lang = 'en' ) { $ labelArcs = $ taxonomy -> getGenericArc ( XBRL_Constants :: $ genericElementLabel , $ target -> extendedLinkRoleUri , $ target -> label , $ target -> path , null , $ target -> linkbase ) ; if ( ! $ labelArcs ) return true ; foreach ( $ labelA...
Add the label to a resource
34,117
private function validateEqualityDefinition ( $ taxonomy ) { \ XBRL_Log :: getInstance ( ) -> info ( "Need to implement equality definition validation" ) ; $ taxonomy -> getGenericArc ( XBRL_Constants :: $ arcRoleVariableEqualityDefinition ) ; return true ; }
Process an equality definition
34,118
private function evaluate ( $ variableSet ) { if ( ! $ this -> canEvaluate ) return ; if ( isset ( $ variableSet -> evaluated ) ) return true ; $ variableSet -> nsMgr = $ this -> nsMgr ; $ variableSet -> xbrlInstance = $ this -> instances [ $ this -> instanceQName -> clarkNotation ( ) ] ; if ( $ variableSet -> evaluate...
Evaluate the formula . At the moment the instanceQNames points to the current instance being processed
34,119
public static function FromInstanceDocumentWithExtensionTaxonomy ( $ instance_document , $ compiledLocation , $ className = 'XBRL' , $ useCache = false ) { try { $ instance = new XBRL_Instance ( ) ; $ instance -> compiledLocation = $ compiledLocation ; $ instance -> className = $ className ; if ( ! $ instance -> initia...
Create an instance from an instance document using a base taxonomy if possible
34,120
public static function FromInstanceDocument ( $ instance_document , $ taxonomy_file = null , & $ instance = null , $ allowNested = false , $ useCache = false ) { try { $ instance = new XBRL_Instance ( ) ; $ instance -> allowNested = $ allowNested ; if ( ! $ instance -> initialise ( $ instance_document , $ taxonomy_file...
Create an instance from an instance document
34,121
public static function FromInstanceCache ( $ cache_path , $ cache_basename , $ taxonomyNamespace , $ compiledTaxonomyFile ) { $ xbrl = XBRL :: load_taxonomy ( $ compiledTaxonomyFile ) ; if ( ! $ xbrl ) return false ; $ json = null ; if ( XBRL :: endsWith ( $ cache_basename , '.zip' ) ) { $ zip = new \ ZipArchive ( ) ; ...
Creates an instance object from a JSON string perhaps in a zip file
34,122
public function toInstanceCache ( $ output_path , $ output_basename ) { $ json = json_encode ( array ( 'allowNested' => $ this -> allowNested , 'contextDimensionMemberList' => $ this -> contextDimensionMemberList , 'contexts' => $ this -> contexts , 'document_name' => $ this -> document_name , 'duplicateFacts' => $ thi...
Perist an instance to a file containing a JSON representation
34,123
public static function reset ( $ resetGlobal = true ) { XBRL_Instance :: $ instance_taxonomy = array ( ) ; if ( ! $ resetGlobal ) return ; XBRL_Global :: reset ( ) ; XBRL_Types :: reset ( ) ; }
Resets the lists of existing instance taxonomies
34,124
public function getEntityForElement ( $ element ) { if ( isset ( $ element [ 'contextRef' ] ) ) { return $ this -> contexts [ $ element [ 'contextRef' ] ] [ 'entity' ] [ 'identifier' ] [ 'value' ] ; } if ( isset ( $ element [ 'tuple_elements' ] ) ) { foreach ( $ element [ 'tuple_elements' ] as $ elementKey => $ tuple_e...
Get the entity of the element . For a simple concept this is easy but for a tuple its necessary to look at the tuple elements
34,125
public function getContext ( $ id ) { return isset ( $ this -> contexts [ $ id ] ) ? $ this -> contexts [ $ id ] : null ; }
Get a specific context
34,126
public function hasDimension ( $ contextRef , $ dimension , $ includeDefault = false ) { if ( ! isset ( $ this -> contexts [ $ contextRef ] ) ) { return false ; } $ paths = array ( array ( 'entity' , 'segment' ) , array ( 'scenario' ) , array ( 'entity' , 'scenario' ) , array ( 'segment' ) , ) ; foreach ( $ paths as $ ...
Returns true if the dimension reference can be found in a segment or scenario
34,127
public function getUnit ( $ id ) { return isset ( $ this -> units [ $ id ] ) ? $ this -> units [ $ id ] : null ; }
Get a specific unit
34,128
public function getElement ( $ id ) { $ result = array ( ) ; if ( isset ( $ this -> elements [ $ id ] ) ) { foreach ( $ this -> elements [ $ id ] as $ key => & $ element ) { if ( isset ( $ element [ 'parent' ] ) ) continue ; $ element [ 'parent' ] = 'xbrl' ; } unset ( $ element ) ; $ result = $ this -> elements [ $ id ...
Get a specific element
34,129
public function getPrefixForDocumentNamespace ( $ namespace ) { if ( is_null ( $ this -> cacheDocumentNamespaces ) ) { $ this -> cacheDocumentNamespaces = array_flip ( $ this -> instance_xml -> getDocNamespaces ( ) ) ; $ standardNamespaces = array_flip ( XBRL_Constants :: $ standardPrefixes ) ; $ docNamespace = array_s...
Returns a prefix for an xbrlInstance namespace This only looks at the namespaces in the root of the instance dopcument
34,130
public function getPrefixForNamespace ( $ namespace ) { if ( ! isset ( $ this -> cacheNamespaces ) || count ( $ this -> cacheNamespaces ) != count ( $ this -> instance_namespaces ) ) { $ this -> cacheNamespaces = array_flip ( $ this -> instance_namespaces ) ; $ standardNamespaces = array_flip ( XBRL_Constants :: $ stan...
Get the prefix of a namespace
34,131
private function & getEntryForGuid ( $ guid ) { if ( ! isset ( $ this -> uniqueFactIds [ $ guid ] ) ) { return false ; } $ facts = $ this -> getElement ( $ this -> uniqueFactIds [ $ guid ] ) ; foreach ( $ facts as $ key => & $ entry ) { if ( $ entry [ 'guid' ] == $ guid ) return $ entry ; } return false ; }
Returns an entry for a guid or false
34,132
private function normalizePrefix ( $ localPrefix ) { if ( $ localPrefix == 'xml' ) return $ localPrefix ; $ namespace = $ this -> getInstanceNamespaces ( ) [ $ localPrefix ] ; $ taxonomy = $ this -> getInstanceTaxonomy ( ) -> getTaxonomyForNamespace ( $ namespace ) ; return $ taxonomy ? $ taxonomy -> getPrefix ( ) : $ ...
Return the schema prefix corresponding to the prefix used locally
34,133
public function getFootnoteForFact ( $ fact , $ lang = null , $ linkrole = null , $ arcrole = null , $ footnoterole = null ) { if ( ! is_array ( $ fact ) ) return false ; if ( ! isset ( $ fact [ 'id' ] ) ) return false ; $ href = "#{$fact['id']}" ; if ( ! isset ( $ this -> footnotes [ 'arcs' ] [ $ href ] ) ) return fal...
Get a footnote for a fact or returns false
34,134
public static function inferDecimals ( $ value , $ precision ) { if ( is_string ( $ value ) ) { if ( $ value == 'INF' ) return "INF" ; $ value = intval ( $ value ) ; } if ( $ value == 0 || $ precision === "INF" ) return INF ; if ( $ precision == 0 ) return false ; return $ precision - intval ( floor ( log10 ( abs ( $ v...
Infer the decimals given a value and a precision value
34,135
public static function inferPrecision ( $ value , $ decimals ) { if ( $ decimals == "INF" ) return INF ; if ( ! is_numeric ( $ value ) ) return false ; $ fValue = floatval ( $ value ) ; if ( $ value === false ) return false ; if ( $ decimals === "" ) return 0 ; $ precision = 0 ; if ( preg_match ( '/[-+]?[0]*([1-9]?[0-9...
Infer the precision given a value and a decimals value
34,136
function getNumericPresentation ( & $ entry ) { if ( isset ( $ entry [ 'precision' ] ) && strval ( $ entry [ 'precision' ] ) === '0' ) { return NAN ; } $ decimals = $ this -> getDecimals ( $ entry ) ; return $ decimals == INF ? $ entry [ 'value' ] : round ( $ entry [ 'value' ] , $ this -> getDecimals ( $ entry ) , PHP_...
Generate a presentation of a fact value taking into account decimals and precision settings
34,137
private function validateFacts ( $ elements , $ parent , & $ types , & $ prefixes ) { $ instanceTaxonomy = $ this -> getInstanceTaxonomy ( ) ; $ primaryItems = $ instanceTaxonomy -> getDefinitionPrimaryItems ( false ) ; foreach ( $ elements as $ factKey => $ fact ) { $ drsHypercubes = false ; foreach ( $ fact as $ entr...
Process each fact in the instance document which may have multiple entries
34,138
private function validateRequiresElementArcs ( XBRL_Types & $ types ) { $ arcs = $ this -> getInstanceTaxonomy ( ) -> getRequireElementsList ( ) ; if ( ! $ arcs ) return true ; foreach ( $ arcs as $ from => $ targets ) { $ parts = parse_url ( $ from ) ; if ( ! isset ( $ parts [ 'path' ] ) || ! isset ( $ parts [ 'fragme...
Validate any requires element arcs
34,139
private function validateDivide ( $ divide , $ unitId , $ types ) { $ numeratorValidation = true ; $ denominatorValidation = true ; if ( isset ( $ divide [ 'numerator' ] ) ) { if ( empty ( $ divide [ 'numerator' ] ) ) { $ this -> log ( ) -> instance_validation ( "4.8.4" , "The 'unitNumerator' MUST NOT be empty" , array...
Validates the measure component of a unit definition
34,140
private function validateMeasure ( $ measure , $ unitId , $ types , $ forceCurrencyCheck = false ) { if ( empty ( $ measure ) ) { $ this -> log ( ) -> instance_validation ( "4.8.2" , "The measure cannot be empty" , array ( 'unit' => $ unitId ) ) ; return false ; } $ qName = qname ( $ measure , $ this -> instance_namesp...
Validates the divide component of a unit definition
34,141
private function validateExplicitMembers ( $ component , $ contextId , $ types , $ componentName , & $ data ) { if ( XBRL_Instance :: isEmpty ( $ component , 'dimension' ) || XBRL_Instance :: isEmpty ( $ component , 'member' ) ) { XBRL_Log :: getInstance ( ) -> instance_validation ( $ componentName == XBRL_Constants ::...
Used to validate explicit members in dimensional texonomies
34,142
private function validateOtherComponentTypes ( $ componenttMembers , $ contextId , $ types , $ componentName , & $ data ) { $ xbrliPrefixes = array ( 'xbrli' ) ; foreach ( $ this -> instance_namespaces as $ prefix => $ namespace ) { if ( $ namespace == XBRL_Constants :: $ standardPrefixes [ STANDARD_PREFIX_XBRLI ] ) { ...
Validate segment and scenarios that have custom elements as their content
34,143
private function validateNonDimensionMembers ( $ component , $ contextId , $ types , $ componentName , & $ data ) { if ( empty ( $ component ) ) { XBRL_Log :: getInstance ( ) -> instance_validation ( $ componentName == XBRL_Constants :: $ xbrliScenario ? "4.7.4" : "4.7.3.2" , "A $componentName cannot be empty" , array ...
Used to validate non - dimension segments and scenarios
34,144
public function getContextDimensions ( $ context ) { if ( isset ( $ context [ 'entity' ] [ 'segment' ] ) ) return $ this -> getComponentDimensions ( $ context [ 'entity' ] [ 'segment' ] ) ; elseif ( isset ( $ context [ 'segment' ] ) ) return $ this -> getComponentDimensions ( $ context [ 'segment' ] ) ; elseif ( isset ...
Get a list of the dimensions and associated member for a context
34,145
public function getComponentDimensions ( $ component ) { $ result = array ( ) ; if ( isset ( $ component [ 'explicitMember' ] ) ) $ dimensions = $ component [ 'explicitMember' ] ; else if ( isset ( $ component [ 'typedMember' ] ) ) $ dimensions = $ component [ 'typedMember' ] ; else return $ result ; foreach ( $ dimens...
Get a list of the dimensions and associated member for a scenario or segment context component
34,146
public function isDimensionallyValid ( $ context , $ hypercubeDimensions , $ closed ) { if ( is_string ( $ context ) ) { $ context = $ this -> getContext ( $ context ) ; } $ contextDimensions = $ this -> getContextDimensions ( $ context ) ; $ invalidDimensions = array_diff_key ( $ contextDimensions , $ hypercubeDimensi...
Tests whether a context is valid for the dimensions of a hypercube
34,147
public function isHypercubeDimensionallyValid ( $ context , $ hypercube , $ closed ) { $ hypercubeDimensions = array_reduce ( $ hypercube [ 'dimensions' ] , function ( $ carry , $ dimension ) use ( & $ hypercubeDimensions ) { $ dimTaxonomy = $ this -> getInstanceTaxonomy ( ) -> getTaxonomyForXSD ( $ dimension [ 'label'...
Tests whether a context is valid for a hypercube
34,148
public function isDRSValidForFact ( $ fact , $ drs ) { foreach ( $ drs as $ hypercube => $ roles ) { foreach ( $ roles as $ role => $ hypercubeItems ) { if ( ! isset ( $ hypercubes [ $ hypercube ] [ $ role ] ) ) { $ closed = isset ( $ hypercubeItems [ 'parents' ] [ $ fact [ 'label' ] ] [ 'closed' ] ) && $ hypercubeItem...
Returns true if ANY hypercube in a DRS is valid for the context
34,149
public function getContext ( $ ref ) { return isset ( $ this -> contexts [ $ ref ] ) ? $ this -> contexts [ $ ref ] : false ; }
Get a specific context by reference
34,150
public function getContextsByRef ( $ refs ) { $ contexts = array ( ) ; if ( is_array ( $ refs ) ) foreach ( $ refs as $ ref ) { if ( ! isset ( $ this -> contexts [ $ ref ] ) ) continue ; $ contexts [ $ ref ] = $ this -> contexts [ $ ref ] ; } return new ContextsFilter ( $ this -> instance , $ contexts ) ; }
Get a set of contexts by reference
34,151
public function ContextWithDuration ( $ months ) { $ durationContexts = $ this -> DurationContexts ( ) ; $ oneDay = new DateInterval ( "P1D" ) ; return new ContextsFilter ( $ instance , array_filter ( $ durationContexts -> getContexts ( ) , function ( $ context ) use ( $ months , $ oneDay ) { $ interval = date_diff ( n...
Return context with a specified number of months duration
34,152
public function EntityContexts ( $ entity , $ scheme = null ) { $ filtered = array_filter ( $ this -> contexts , function ( $ context ) use ( $ entity , $ scheme ) { if ( ! isset ( $ context [ 'entity' ] [ 'identifier' ] [ 'value' ] ) ) return false ; if ( $ context [ 'entity' ] [ 'identifier' ] [ 'value' ] == $ entity...
Returns the context for a specfic entity
34,153
public function NoSegmentContexts ( ) { $ filtered = array_filter ( $ this -> contexts , function ( $ context ) { return ( ! isset ( $ context [ 'entity' ] [ 'segment' ] [ 'explicitMember' ] ) || count ( $ context [ 'entity' ] [ 'segment' ] [ 'explicitMember' ] ) == 0 ) && ( ! isset ( $ context [ 'entity' ] [ 'scenario...
Return a list of the contexts without a segment
34,154
public function AllNamespaces ( ) { $ contexts = & $ this -> contexts ; $ instance = & $ this -> instance ; $ result = array_reduce ( array_keys ( $ this -> contexts ) , function ( $ carry , $ context ) use ( & $ contexts , & $ instance ) { if ( ! isset ( $ contexts [ $ context ] [ 'entity' ] [ 'segment' ] [ 'explicitM...
Return an array of all namespaces used by the contexts
34,155
public function AllEntities ( ) { $ contexts = & $ this -> contexts ; $ result = array_reduce ( array_keys ( $ this -> contexts ) , function ( $ carry , $ context ) use ( & $ contexts ) { if ( ! isset ( $ contexts [ $ context ] [ 'entity' ] [ 'identifier' ] [ 'value' ] ) ) return $ carry ; $ qname = new QName ( null , ...
Return an array of all entities used by the contexts
34,156
public function AllExplicitDimensions ( ) { $ contexts = & $ this -> contexts ; $ namespaces = $ this -> instance -> getInstanceNamespaces ( ) ; $ result = array_reduce ( array_keys ( $ this -> contexts ) , function ( $ carry , $ context ) use ( & $ contexts , & $ namespaces ) { $ ctx = $ contexts [ $ context ] ; $ exp...
Return an array of all explicit dimensions used by the contexts
34,157
public function AllTypedDimensions ( ) { $ contexts = & $ this -> contexts ; $ namespaces = $ this -> instance -> getInstanceNamespaces ( ) ; $ result = array_reduce ( array_keys ( $ this -> contexts ) , function ( $ carry , $ context ) use ( & $ contexts , & $ namespaces ) { $ ctx = $ contexts [ $ context ] ; $ typedM...
Return an array of all typed dimensions used by the contexts
34,158
public function AllYears ( ) { $ result = array_reduce ( $ this -> contexts , function ( $ carry , $ context ) { if ( ! isset ( $ context [ 'period' ] ) ) return $ carry ; $ parts = explode ( "-" , $ context [ 'period' ] [ 'startDate' ] ) ; $ carry [ $ parts [ 0 ] ] = isset ( $ carry [ $ parts [ 0 ] ] ) ? $ carry [ $ p...
Return an array of all years used by the contexts
34,159
private function getSegment ( $ context ) { if ( is_string ( $ context ) ) { if ( ! isset ( $ this -> contexts [ $ context ] ) ) return null ; $ context = $ this -> contexts [ $ context ] ; } if ( isset ( $ context [ 'segment' ] ) ) return $ context [ 'segment' ] ; if ( isset ( $ context [ 'entity' ] [ 'segment' ] ) ) ...
Return the available segment element from a context
34,160
private function getScenario ( $ context ) { if ( is_string ( $ context ) ) { if ( ! isset ( $ this -> contexts [ $ context ] ) ) return null ; $ context = $ this -> contexts [ $ context ] ; } if ( isset ( $ context [ 'scenario' ] ) ) return $ context [ 'scenario' ] ; if ( isset ( $ context [ 'entity' ] [ 'scenario' ] ...
Return the available scenario element from a context
34,161
public function getPeriodLabel ( ) { $ contexts = $ this -> contexts ; try { if ( ! $ this -> DurationContexts ( ) -> count ( ) && count ( $ this -> AllYears ( ) ) == 1 ) { $ context = reset ( $ this -> contexts ) ; return $ context [ 'period' ] [ 'endDate' ] ; } else { $ this -> sortByStartDate ( ) ; $ startContext = ...
Return a period label for the context collection
34,162
public function remove ( $ contexts ) { if ( is_string ( $ contexts ) ) { unset ( $ this -> contexts [ $ contexts ] ) ; } else if ( $ contexts instanceof ContextsFilter ) { $ contexts = array_keys ( $ contexts -> getContexts ( ) ) ; } if ( is_array ( $ contexts ) ) { foreach ( $ contexts as $ context ) { unset ( $ this...
Remove one or more contexts . The instance will be changed and will be removed .
34,163
public function ElementsByName ( $ names ) { if ( is_string ( $ names ) ) $ names = array_map ( 'trim' , explode ( "," , $ names ) ) ; if ( ! is_array ( $ names ) ) throw new Exception ( 'InstanceElementsFilter::ElementsByName $names must be a string or array' ) ; $ names = array_flip ( $ names ) ; return new InstanceE...
Return a list of elements filtered by one or more names
34,164
public function ElementsByContexts ( $ contexts ) { if ( is_string ( $ contexts ) ) $ contexts = array_map ( 'trim' , explode ( "," , $ contexts ) ) ; if ( is_a ( $ contexts , 'ContextsFilter' ) ) $ contexts = $ contexts -> Keys ( ) ; if ( ! is_array ( $ contexts ) ) throw new Exception ( 'InstanceElementsFilter::Eleme...
Return a list of elements based on a set of contexts
34,165
public function ElementsByNamespaces ( $ namespaces ) { if ( is_string ( $ namespaces ) ) $ namespaces = array_map ( 'trim' , explode ( "," , $ namespaces ) ) ; if ( ! is_array ( $ namespaces ) ) throw new Exception ( 'InstanceElementsFilter::ElementsByName $namespaces must be a string or array' ) ; $ namespaces = arra...
Return a list of elements based on a set of namespaces
34,166
public function ElementsByItemType ( $ types ) { if ( is_string ( $ types ) ) $ types = array_map ( 'trim' , explode ( "," , $ types ) ) ; if ( ! is_array ( $ types ) ) throw new Exception ( 'InstanceElementsFilter::ElementsByName $types must be a string or array' ) ; $ types = array_flip ( array_map ( 'strtolower' , $...
Return a list of elements based on a set of item types
34,167
public function getNamespaces ( ) { $ namespaces = $ this -> instance -> getInstanceNamespaces ( ) ; $ usedNamespaces = array_reduce ( $ this -> elements , function ( $ carry , $ element ) use ( $ namespaces ) { foreach ( $ element as $ key => $ entry ) { $ namespace = isset ( $ namespaces [ $ entry [ 'namespace' ] ] )...
Return a list of the namespaces used by the elements
34,168
public function getSubstitutionGroups ( ) { $ usedGroups = array_reduce ( $ this -> elements , function ( $ carry , $ element ) { foreach ( $ element as $ key => $ entry ) { $ group = $ entry [ 'taxonomy_element' ] [ 'substitutionGroup' ] ; if ( ! isset ( $ carry [ $ group ] ) ) $ carry [ $ group ] = 1 ; } return $ car...
Return a list of the substitution groups used by the elements
34,169
public function getItemTypes ( ) { $ usedTypes = array_reduce ( $ this -> elements , function ( $ carry , $ element ) { foreach ( $ element as $ key => $ entry ) { $ type = $ entry [ 'taxonomy_element' ] [ 'type' ] ; if ( empty ( $ type ) ) continue ; if ( ! isset ( $ carry [ $ type ] ) ) { $ carry [ $ type ] = 1 ; } }...
Return a list of the types used by the elements
34,170
public function UniqueElementEntries ( ) { $ result = array ( ) ; foreach ( $ this -> elements as $ name => $ entries ) { if ( ! isset ( $ result [ $ name ] ) ) $ result [ $ name ] = array ( ) ; foreach ( $ entries as $ key => $ entry ) { if ( isset ( $ entry [ 'tuple_elements' ] ) ) { $ result [ $ name ] [ ] = $ entry...
Reduce elements so they only have unique entries
34,171
public function getFileAsXML ( $ path ) { try { $ xml = $ this -> getFile ( $ this -> getActualUri ( $ path ) ) ; isXml ( $ xml ) ; return simplexml_load_string ( $ xml ) ; } catch ( Exception $ ex ) { throw XBRL_TaxonomyPackageException :: withError ( "tpe:invalidMetaDataFile" , $ ex -> getMessage ( ) ) ; } }
Return the contents of a file given a path
34,172
public function getAllEntryPoint ( ) { $ entryPoints = $ this -> getSchemaEntryPoints ( ) ; $ alls = array_filter ( $ entryPoints , function ( $ entryPoint ) { return strpos ( $ entryPoint , "entryAll" ) !== false ; } ) ; return $ alls ? reset ( $ alls ) : false ; }
Return the url for the all entry point
34,173
public static function attribute_equal ( $ value1 , $ value2 , $ type1 , $ type2 , & $ namespaces , & $ types = null ) { $ qname1 = qname ( $ value1 , $ namespaces ) ; $ qname2 = qname ( $ value2 , $ namespaces ) ; if ( ! is_null ( $ qname1 ) && ! is_null ( $ qname1 ) ) { if ( ! $ qname1 -> equals ( $ qname2 ) ) return...
The two attributes have local names and namespaces that are S - Equal and have values that are X - Equal
34,174
public static function divide_equal ( $ d1 , $ d2 , & $ types , & $ namespaces ) { if ( is_null ( $ d1 ) && is_null ( $ d2 ) ) return true ; if ( is_null ( $ d1 ) || is_null ( $ d2 ) ) return false ; $ result = XBRL_Equality :: matchedKeyNames ( $ d1 , $ d2 , array ( 'denominator' , 'numerator' ) ) ; if ( $ result === ...
Make sure divide definitions are equal
34,175
public static function unit_equal ( $ u1 , $ u2 , & $ types , & $ namespaces ) { if ( is_null ( $ u1 ) && is_null ( $ u2 ) ) return true ; if ( is_null ( $ u1 ) || is_null ( $ u2 ) ) return false ; if ( is_string ( $ u1 ) && is_string ( $ u2 ) ) { return XBRL_Equality :: attribute_equal ( $ u1 , $ u2 , XBRL_Equality ::...
Make sure unit definitions are equal
34,176
public static function compare_arrays ( $ value1 , $ value2 ) { if ( count ( $ value1 ) != count ( $ value2 ) ) return false ; $ types = XBRL_Types :: getInstance ( ) ; foreach ( $ value1 as $ key => $ value ) { if ( ! isset ( $ value2 [ $ key ] ) ) return false ; if ( $ key == 'id' ) { $ pattern = "/^" . SchemaTypes :...
Compare arrays ignoring the position of the elements
34,177
public static function xequalAttributeType ( $ types , $ localName , $ prefix ) { $ attribute = $ types -> getAttribute ( $ localName , $ prefix ) ; if ( ! $ attribute || ! isset ( $ attribute [ 'types' ] ) || ! count ( $ attribute [ 'types' ] ) ) return XBRL_Equality :: $ EQUALITY_TYPE_STRING ; return XBRL_Equality ::...
Get the xequal comparison type an attribute
34,178
private static function xequalElementType ( $ types , $ localName , $ prefix ) { $ element = $ types -> getElement ( $ localName , $ prefix ) ; if ( ! $ element || ! isset ( $ element [ 'types' ] ) || ! count ( $ element [ 'types' ] ) ) return XBRL_Equality :: $ EQUALITY_TYPE_STRING ; return XBRL_Equality :: xEqualComp...
Get the xequal comparison type an element
34,179
public static function compare_arrays_ordinal ( $ array1 , $ array2 ) { if ( count ( $ array1 ) != count ( $ array2 ) ) return false ; if ( ! count ( $ array1 ) ) return true ; $ types = XBRL_Types :: getInstance ( ) ; for ( $ i = 0 ; $ i < count ( $ array1 ) ; $ i ++ ) { $ key1 = key ( $ array1 ) ; $ key2 = key ( $ ar...
Compare arrays using the position of the elements
34,180
private static function hasElement ( $ a , $ b , $ elementName ) { return ( isset ( $ a [ $ elementName ] ) && isset ( $ b [ $ elementName ] ) ) || ( ! isset ( $ a [ $ elementName ] ) && ! isset ( $ b [ $ elementName ] ) ) ; }
Test to make sure an element exists in both arrays
34,181
public function getValue ( $ variableSet , $ evaluationResult , $ log ) { if ( $ this -> source ) { $ sourceFact = $ variableSet -> getSourceFact ( $ this -> source , $ evaluationResult , ASPECT_ENTITY_IDENTIFIER , $ log ) ; if ( is_null ( $ sourceFact ) ) { $ source = is_array ( $ this -> source ) ? "{$this->source['o...
Returns an aspect value
34,182
public static function getPackage ( $ taxonomyPackage , $ additionalPackageClasses = array ( ) ) { if ( ! is_array ( $ additionalPackageClasses ) ) { $ additionalPackageClasses = array ( ) ; } $ packageClassesFile = __DIR__ . '/TaxonomyPackageTypes.json' ; $ packageClasses = null ; if ( file_exists ( __DIR__ . '/Taxono...
Factory to create a package class instance
34,183
public static function fromFile ( string $ filename , $ className ) { $ zipArchive = new ZipArchive ( ) ; try { if ( $ zipArchive -> open ( $ filename ) !== true ) { $ zipArchive = false ; throw new Exception ( "An attempt has been made to open an invalid zip file" ) ; } return self :: fromZip ( $ zipArchive , $ classN...
Open a package from a file
34,184
public function compile ( $ output_basename = null , $ compiledPath = null ) { if ( $ this -> isExtensionTaxonomy ( ) ) { return XBRL :: compileExtensionXSD ( $ this -> schemaFile , $ this -> getXBRLClassname ( ) , $ this -> schemaNamespace , $ output_basename , $ compiledPath ) ; } else { return XBRL :: compile ( $ th...
Compile a taxonmy
34,185
public function isCompiled ( $ compiledDir , $ basename = null ) { if ( is_null ( $ basename ) ) { $ basename = $ this -> getSchemaFileBasename ( ) ; } return XBRL :: isCompiled ( $ compiledDir , $ basename ) ; }
Returns true if the taxonomy in the package is compiled
34,186
public function isExtensionTaxonomy ( ) { if ( is_null ( $ this -> isExtensionTaxonomy ) ) { $ this -> isExtensionTaxonomy = $ this -> getIsExtensionTaxonomy ( ) ; } return $ this -> isExtensionTaxonomy ; }
Returns true if the package contains an extension taxonomy
34,187
protected function getIsExtensionTaxonomy ( ) { $ this -> determineSchemaFile ( ) ; $ xml = $ this -> getFileAsXML ( $ this -> getActualUri ( $ this -> schemaFile ) ) ; $ xml -> registerXPathNamespace ( SCHEMA_PREFIX , SCHEMA_NAMESPACE ) ; foreach ( $ xml -> xpath ( "/xs:schema/xs:import" ) as $ tag => $ element ) { $ ...
Can be implemented by concrete classes to return true if the taxonomy is an extension taxonomy This default implementation looks at the XBRL class name advertised by the class to determine if the schema file contains one of the entry points of the XBRL class .
34,188
public function getInstanceDocumentAsMemoryFile ( ) { $ xbrl = $ this -> getInstanceDocument ( false ) ; if ( ! $ xbrl ) return false ; $ instanceFilename = "mem://{$this->instanceDocument}" ; if ( ! class_exists ( "MemoryStream" , true ) ) { $ utiltiesPath = isset ( $ _ENV [ 'UTILITY_LIBRARY_PATH' ] ) ? $ _ENV [ 'UTIL...
Retruns the instance document contents as named memory stream file
34,189
public function getInstanceDocument ( $ asSimpleXML = true ) { if ( ! $ this -> schemaFile || ! $ this -> schemaNamespace ) { echo "The saveTaxonomy function must be called before using this function" ; return false ; } if ( $ this -> instanceDocument ) { $ xml = $ asSimpleXML ? $ this -> getFileAsXML ( $ this -> insta...
Get the instance document xml
34,190
protected function processSchemaDocument ( $ context , $ content , $ throwException = true ) { if ( ! isXml ( $ content , $ throwException ) ) return false ; if ( is_null ( $ this -> schemaNamespace ) ) { $ this -> schemaNamespace = $ this -> getTargetNamespace ( $ this -> schemaFile , $ content , $ throwException ) ; ...
Processes the schema document in a consistent way
34,191
protected function setUrlMap ( $ schemaNamespace = null , $ schemaFile = null ) { if ( $ schemaNamespace && ! $ schemaFile || $ schemaFile && ! $ schemaNamespace ) { throw new Exception ( 'setUrlMap: If a schema file or schema namespace is provided to the setUrlMapo function then both MUST be provided.' ) ; } if ( ! $ ...
Implements a Url map that allows a simple xsd name to map to a path that can be found in the cache
34,192
public function loadTaxonomy ( $ compiledPath = null ) { if ( $ this -> isExtensionTaxonomy ( ) ) { return XBRL :: loadExtensionXSD ( $ this -> schemaFile , $ this -> getXBRLClassname ( ) , $ this -> schemaNamespace , $ compiledPath ) ; } else { if ( $ this -> isCompiled ( $ compiledPath , $ this -> getSchemaFileBasena...
Load the taxonomy associated with this package
34,193
public function notify ( $ event ) { if ( ! isset ( $ event [ 'section' ] ) || ! isset ( $ event [ 'source' ] ) ) return ; $ source = $ event [ 'section' ] ; $ source = array ( 'message' => $ event [ 'message' ] , 'details' => $ event [ 'source' ] ) ; $ this -> addSection ( $ event [ 'section' ] , $ source ) ; }
Called by the log instance to pass log information
34,194
public function partitionFacts ( $ variableSet ) { if ( ! $ this -> var -> bindAsSequence ) return ; $ groups = array ( ) ; if ( $ this -> facts instanceof XPath2NodeIterator ) { $ groups [ ] = $ this -> facts -> CloneInstance ( ) ; } else if ( is_array ( $ this -> facts ) ) { $ groups [ ] = DocumentOrderNodeIterator :...
If the bound variable specifies bind as a sequence then put the facts into a container
34,195
public function equals ( $ other ) { try { return $ this -> qnameValueHash == $ other -> qnameValueHash || ( $ this -> localName == $ other -> localName && $ this -> namespaceURI == $ other -> namespaceURI ) ; } catch ( \ Exception $ ex ) { return false ; } }
Test whether one QName equals another
34,196
public function lessThan ( $ other ) { return $ this -> namespaceURI == null && $ other -> namespaceURI || $ this -> namespaceURI && $ other -> namespaceURI && $ this -> namespaceURI < $ other -> namespaceURI || $ this -> namespaceURI == $ other -> namespaceURI && $ this -> localName < $ other -> localName ; }
Test whether one QName is less than another
34,197
public function lessThanOrEqual ( $ other ) { return $ this -> namespaceURI == null && $ other -> namespaceURI || $ this -> namespaceURI && $ other -> namespaceURI && $ this -> namespaceURI < $ other -> namespaceURI || $ this -> namespaceURI == $ other -> namespaceURI && $ this -> localName <= $ other -> localName ; }
Test whether one QName is less than or equal to another
34,198
public function greaterThan ( $ other ) { return $ this -> namespaceURI && $ other -> namespaceURI == null || $ this -> namespaceURI && $ other -> namespaceURI && $ this -> namespaceURI > $ other -> namespaceURI || $ this -> namespaceURI == $ other -> namespaceURI && $ this -> localName > $ other -> localName ; }
Test whether one QName is greater than another
34,199
public function greaterThanOrEqual ( $ other ) { return $ this -> namespaceURI && $ other -> namespaceURI == null || $ this -> namespaceURI && $ other -> namespaceURI && $ this -> namespaceURI > $ other -> namespaceURI || $ this -> namespaceURI == $ other -> namespaceURI && $ this -> localName >= $ other -> localName ;...
Test whether one QName is greater or equal to another