@@ -486,7 +486,9 @@ public function importArchiMateFileFromPath(array $options=[]): array
486486 $ statistics = $ this ->calculateObjectStatistics (normalizedData: $ normalizedData , savedObjects: $ savedObjects );
487487
488488 // Calculate performance metrics.
489- $ totalObjects = $ statistics ['summary ' ]['total_objects_created ' ] + $ statistics ['summary ' ]['total_objects_updated ' ];
489+ $ created = $ statistics ['summary ' ]['total_objects_created ' ];
490+ $ updated = $ statistics ['summary ' ]['total_objects_updated ' ];
491+ $ totalObjects = $ created + $ updated ;
490492 if ($ totalObjects > 0 ) {
491493 $ itemsPerSecond = $ totalObjects / $ totalTime ;
492494 } else {
@@ -2991,7 +2993,14 @@ private function extractViewNodesRecursively($nodeData, array $elementsLookup=[]
29912993 }
29922994
29932995 // Add GEMMA-specific properties if they exist.
2994- $ gemmaProperties = ['gemmaType ' , 'bivScoreBbn ' , 'belangrijksteReden ' , 'beschikbaarheid ' , 'integriteit ' , 'vertrouwelijkheid ' ];
2996+ $ gemmaProperties = [
2997+ 'gemmaType ' ,
2998+ 'bivScoreBbn ' ,
2999+ 'belangrijksteReden ' ,
3000+ 'beschikbaarheid ' ,
3001+ 'integriteit ' ,
3002+ 'vertrouwelijkheid ' ,
3003+ ];
29953004 foreach ($ gemmaProperties as $ prop ) {
29963005 if (isset ($ element [$ prop ]) === true ) {
29973006 $ viewNode [$ prop ] = $ element [$ prop ];
@@ -3013,7 +3022,8 @@ private function extractViewNodesRecursively($nodeData, array $elementsLookup=[]
30133022 // engine can look up parents via graph.getCell(parentId).
30143023 $ viewNodes [] = $ viewNode ;
30153024
3016- // Handle child nodes recursively (flatten hierarchy into single array while preserving parent-child relationships).
3025+ // Handle child nodes recursively (flatten hierarchy into single
3026+ // array while preserving parent-child relationships).
30173027 if (isset ($ node ['node ' ]) === true ) {
30183028 $ childNodes = $ this ->extractViewNodesRecursively (nodeData: $ node ['node ' ], elementsLookup: $ elementsLookup );
30193029
@@ -3147,12 +3157,17 @@ private function extractNodesRecursively($nodeData, array $elementsLookup=[]): a
31473157
31483158 // RECURSIVE: Extract child nodes if they exist (with element splicing).
31493159 if (isset ($ node ['node ' ]) === true ) {
3150- $ processedNode ['children ' ] = $ this ->extractNodesRecursively (nodeData: $ node ['node ' ], elementsLookup: $ elementsLookup );
3160+ $ processedNode ['children ' ] = $ this ->extractNodesRecursively (
3161+ nodeData: $ node ['node ' ],
3162+ elementsLookup: $ elementsLookup
3163+ );
31513164 }
31523165
31533166 // RECURSIVE: Extract child connections if they exist.
31543167 if (isset ($ node ['connection ' ]) === true ) {
3155- $ processedNode ['connections ' ] = $ this ->extractConnectionsRecursively (connectionData: $ node ['connection ' ]);
3168+ $ processedNode ['connections ' ] = $ this ->extractConnectionsRecursively (
3169+ connectionData: $ node ['connection ' ]
3170+ );
31563171 }
31573172
31583173 $ nodes [] = $ processedNode ;
@@ -3247,7 +3262,9 @@ private function extractElementProperties(array $element): array
32473262 foreach ($ element as $ key => $ value ) {
32483263 if (in_array ($ key , $ excludedKeys ) === false && in_array ($ key , $ basicProperties ) === false ) {
32493264 // Only include non-object values or simple arrays.
3250- if (is_scalar ($ value ) === true || (is_array ($ value ) === true && $ this ->isComplexArra === falsey (array: $ value ))) {
3265+ if (is_scalar ($ value ) === true
3266+ || (is_array ($ value ) === true && $ this ->isComplexArra === falsey (array: $ value ))
3267+ ) {
32513268 $ properties [$ key ] = $ value ;
32523269 }
32533270 }
@@ -3955,7 +3972,9 @@ private function extractGemmaType(array $object): ?string
39553972 */
39563973 private function processGemmaReferenceComponentStandards (array $ objects ): array
39573974 {
3958- $ this ->logger ->info ('Processing GEMMA Referentiecomponent-Standaard and StandaardVersie relationships with optimized single-pass algorithm ' );
3975+ $ this ->logger ->info (
3976+ 'Processing GEMMA Referentiecomponent-Standaard and StandaardVersie relationships with single-pass algorithm '
3977+ );
39593978
39603979 // OPTIMIZATION: Single-pass processing - collect all data types at once.
39613980 $ referentieComponenten = [];
@@ -4138,7 +4157,8 @@ private function processGemmaReferenceComponentStandards(array $objects): array
41384157 // Remove duplicates and add to referentiecomponent.
41394158 // Use 'gekoppeldeStandaardVersies' to avoid conflict with inversedBy on 'standaardVersies'.
41404159 if (empty ($ standaardVersiesForRefComp ) === false ) {
4141- $ objects [$ objectIndex ]['gekoppeldeStandaardVersies ' ] = array_values (array_unique ($ standaardVersiesForRefComp ));
4160+ $ uniqueVersies = array_values (array_unique ($ standaardVersiesForRefComp ));
4161+ $ objects [$ objectIndex ]['gekoppeldeStandaardVersies ' ] = $ uniqueVersies ;
41424162 $ refCompWithVersiesCount ++;
41434163 }
41444164 }//end foreach
@@ -4181,7 +4201,8 @@ private function processStandaardVersieRelationship(
41814201
41824202 // Get relationship type (looking for Specialization).
41834203 // Type can be in 'type' (from _xsi__type) or in _attributes['xsi:type'].
4184- $ relationType = $ relationship ['type ' ] ?? $ relationship ['_xsi__type ' ] ?? $ relationship ['_attributes ' ]['xsi:type ' ] ?? null ;
4204+ $ attrs = $ relationship ['_attributes ' ] ?? [];
4205+ $ relationType = $ relationship ['type ' ] ?? $ relationship ['_xsi__type ' ] ?? $ attrs ['xsi:type ' ] ?? null ;
41854206 if ($ relationType !== 'Specialization ' ) {
41864207 return ;
41874208 }
@@ -4482,7 +4503,10 @@ private function transformViewsOptimized(
44824503 [
44834504 'total_elements ' => count ($ elementsLookup ),
44844505 'referenced_elements ' => count ($ filteredElementsLookup ),
4485- 'optimization_ratio ' => round ((1 - count ($ filteredElementsLookup ) / max (count ($ elementsLookup ), 1 )) * 100 , 1 ).'% ' ,
4506+ 'optimization_ratio ' => round (
4507+ (1 - count ($ filteredElementsLookup ) / max (count ($ elementsLookup ), 1 )) * 100 ,
4508+ 1
4509+ ).'% ' ,
44864510 ]
44874511 );
44884512
@@ -4497,7 +4521,11 @@ private function transformViewsOptimized(
44974521 }
44984522
44994523 // OPTIMIZATION: Use filtered elements lookup for better performance.
4500- $ essentialXmlData = $ this ->extractEssentialXmlData (item: $ item , elementsLookup: $ filteredElementsLookup , schemaType: 'view ' );
4524+ $ essentialXmlData = $ this ->extractEssentialXmlData (
4525+ item: $ item ,
4526+ elementsLookup: $ filteredElementsLookup ,
4527+ schemaType: 'view '
4528+ );
45014529
45024530 $ registerId = $ this ->cachedConfig ['registerId ' ] ?? throw new \RuntimeException (
45034531 'Register ID not found in cached configuration. '
@@ -4885,7 +4913,11 @@ private function transformSectionObjectsBatch(
48854913 }
48864914
48874915 // Create object directly (minimal processing) with element splicing for views.
4888- $ essentialXmlData = $ this ->extractEssentialXmlData (item: $ item , elementsLookup: $ elementsLookup , schemaType: $ schemaType );
4916+ $ essentialXmlData = $ this ->extractEssentialXmlData (
4917+ item: $ item ,
4918+ elementsLookup: $ elementsLookup ,
4919+ schemaType: $ schemaType
4920+ );
48894921
48904922 $ registerId = $ this ->cachedConfig ['registerId ' ] ?? throw new \RuntimeException (
48914923 'Register ID not found in cached configuration. '
@@ -5521,7 +5553,10 @@ private function processViewsMaximumSpeed(
55215553 [
55225554 'total_elements ' => count ($ elementsLookup ),
55235555 'referenced_elements ' => count ($ filteredElementsLookup ),
5524- 'memory_savings_percent ' => round ((1 - count ($ filteredElementsLookup ) / max (count ($ elementsLookup ), 1 )) * 100 , 1 ),
5556+ 'memory_savings_percent ' => round (
5557+ (1 - count ($ filteredElementsLookup ) / max (count ($ elementsLookup ), 1 )) * 100 ,
5558+ 1
5559+ ),
55255560 ]
55265561 );
55275562
@@ -5563,7 +5598,12 @@ private function bulkTransformViews(
55635598 }
55645599
55655600 // SPEED OPTIMIZATION: Direct processing with minimal overhead.
5566- $ essentialXmlData = $ this ->extractEssentialXmlData (item: $ item , elementsLookup: $ elementsLookup , schemaType: 'view ' );
5601+ $ lookup = $ elementsLookup ;
5602+ $ essentialXmlData = $ this ->extractEssentialXmlData (
5603+ item: $ item ,
5604+ elementsLookup: $ lookup ,
5605+ schemaType: 'view '
5606+ );
55675607
55685608 $ regId = $ this ->cachedConfig ['registerId ' ] ?? throw new \RuntimeException (
55695609 'Register ID not found in cached configuration. '
@@ -5731,7 +5771,12 @@ private function createIntelligentBatches(array $objects): array
57315771 'total_objects ' => count ($ objects ),
57325772 'total_batches_created ' => count ($ batches ),
57335773 'batch_sizes ' => array_map ('count ' , $ batches ),
5734- 'estimated_batch_sizes_bytes ' => array_map (fn ($ batch ) => array_sum (array_map ([$ this , 'estimateObjectSize ' ], $ batch )), $ batches ),
5774+ 'estimated_batch_sizes_bytes ' => array_map (
5775+ fn ($ batch ) => array_sum (
5776+ array_map ([$ this , 'estimateObjectSize ' ], $ batch )
5777+ ),
5778+ $ batches
5779+ ),
57355780 ]
57365781 );
57375782
@@ -5875,7 +5920,10 @@ private function calculateObjectStatistics(array $normalizedData, array $savedOb
58755920 };
58765921
58775922 // Fallback: use @self.schema to determine section.
5878- if ($ sectionKey === null && $ this ->cachedConfig !== null && isset ($ this ->cachedConfig ['schemaIds ' ]) === true ) {
5923+ if ($ sectionKey === null
5924+ && $ this ->cachedConfig !== null
5925+ && isset ($ this ->cachedConfig ['schemaIds ' ]) === true
5926+ ) {
58795927 $ objSchemaId = $ object ['@self ' ]['schema ' ] ?? null ;
58805928 if ($ objSchemaId !== null ) {
58815929 $ singularToPlural = [
@@ -5954,12 +6002,13 @@ private function calculateObjectStatistics(array $normalizedData, array $savedOb
59546002 );
59556003
59566004 if (empty ($ errorInfo ) === false ) {
5957- $ statistics [$ sectionKey ]['errors ' ][] = array_values ($ errorInfo )[0 ]['error ' ] ?? 'Unknown validation error ' ;
6005+ $ errMsg = array_values ($ errorInfo )[0 ]['error ' ] ?? 'Unknown validation error ' ;
6006+ $ statistics [$ sectionKey ]['errors ' ][] = $ errMsg ;
59586007 }
59596008 } else {
59606009 // This shouldn't happen, but leave as fallback.
59616010 $ statistics [$ sectionKey ]['unchanged ' ]++;
5962- }
6011+ }//end if
59636012 }//end foreach
59646013 } else {
59656014 // Fallback to old method if no save result is available.
0 commit comments