|  | @@ -78,7 +78,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 78 | 78 |          // Try simple direct match before doing anything more complex! | 
                                                                                                            
                                                            | 79 | 79 |          $candidatePaths = $this->buildDirectTransformationPathsToCRS($source, $target); | 
                                                                                                            
                                                            | 80 | 80 |   | 
                                                                                                            
                                                            | 81 |  | -        usort($candidatePaths, static function (array $a, array $b) { | 
                                                                                                            
                                                            |  | 81 | +        usort($candidatePaths, static function(array $a, array $b) { | 
                                                                                                            
                                                            | 82 | 82 |              return count($a['path']) <=> count($b['path']) ?: $a['accuracy'] <=> $b['accuracy']; | 
                                                                                                            
                                                            | 83 | 83 |          }); | 
                                                                                                            
                                                            | 84 | 84 |   | 
                                                                                                                                                        
                                                        |  | @@ -91,7 +91,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 91 | 91 |          // Otherwise, recursively calculate permutations of intermediate CRSs | 
                                                                                                            
                                                            | 92 | 92 |          $candidatePaths = $this->buildIndirectTransformationPathsToCRS($source, $target); | 
                                                                                                            
                                                            | 93 | 93 |   | 
                                                                                                            
                                                            | 94 |  | -        usort($candidatePaths, static function (array $a, array $b) { | 
                                                                                                            
                                                            |  | 94 | +        usort($candidatePaths, static function(array $a, array $b) { | 
                                                                                                            
                                                            | 95 | 95 |              return count($a['path']) <=> count($b['path']) ?: $a['accuracy'] <=> $b['accuracy']; | 
                                                                                                            
                                                            | 96 | 96 |          }); | 
                                                                                                            
                                                            | 97 | 97 |   | 
                                                                                                                                                        
                                                        |  | @@ -163,7 +163,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 163 | 163 |       */ | 
                                                                                                            
                                                            | 164 | 164 |      protected function buildDirectTransformationPathsToCRS(CoordinateReferenceSystem $source, CoordinateReferenceSystem $target): array | 
                                                                                                            
                                                            | 165 | 165 |      { | 
                                                                                                            
                                                            | 166 |  | -        $cacheKey = $source->getSRID() . '|' . $target->getSRID(); | 
                                                                                                            
                                                            |  | 166 | +        $cacheKey = $source->getSRID().'|'.$target->getSRID(); | 
                                                                                                            
                                                            | 167 | 167 |          if (!isset(self::$directTransformationPathCache[$cacheKey])) { | 
                                                                                                            
                                                            | 168 | 168 |              $simplePaths = [[$source->getSRID(), $target->getSRID()]]; | 
                                                                                                            
                                                            | 169 | 169 |   | 
                                                                                                                                                        
                                                        |  | @@ -192,7 +192,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 192 | 192 |              return []; | 
                                                                                                            
                                                            | 193 | 193 |          } | 
                                                                                                            
                                                            | 194 | 194 |   | 
                                                                                                            
                                                            | 195 |  | -        $cacheKey = $sourceSRID . '|' . $targetSRID; | 
                                                                                                            
                                                            |  | 195 | +        $cacheKey = $sourceSRID.'|'.$targetSRID; | 
                                                                                                            
                                                            | 196 | 196 |          if (!isset(self::$indirectTransformationPathCache[$cacheKey])) { | 
                                                                                                            
                                                            | 197 | 197 |              $simplePaths = [[$sourceSRID]]; | 
                                                                                                            
                                                            | 198 | 198 |   | 
                                                                                                                                                        
                                                        |  | @@ -213,7 +213,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 213 | 213 |              } | 
                                                                                                            
                                                            | 214 | 214 |   | 
                                                                                                            
                                                            | 215 | 215 |              // Filter out any incomplete chains didn't make it to the target | 
                                                                                                            
                                                            | 216 |  | -            $simplePaths = array_filter($simplePaths, static function (array $simplePath) use ($targetSRID) { | 
                                                                                                            
                                                            |  | 216 | +            $simplePaths = array_filter($simplePaths, static function(array $simplePath) use ($targetSRID) { | 
                                                                                                            
                                                            | 217 | 217 |                  return end($simplePath) === $targetSRID; | 
                                                                                                            
                                                            | 218 | 218 |              }); | 
                                                                                                            
                                                            | 219 | 219 |   | 
                                                                                                                                                        
                                                        |  | @@ -241,7 +241,7 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 241 | 241 |              do { | 
                                                                                                            
                                                            | 242 | 242 |                  $to = array_shift($simplePath); | 
                                                                                                            
                                                            | 243 | 243 |                  $wipTransformationsInPath = []; | 
                                                                                                            
                                                            | 244 |  | -                foreach (static::$transformationsByCRSPair[$from . '|' . $to] ?? [] as $transformation) { | 
                                                                                                            
                                                            |  | 244 | +                foreach (static::$transformationsByCRSPair[$from.'|'.$to] ?? [] as $transformation) { | 
                                                                                                            
                                                            | 245 | 245 |                      foreach ($transformationsToMakePath as $transformationToMakePath) { | 
                                                                                                            
                                                            | 246 | 246 |                          $wipTransformationsInPath[] = array_merge($transformationToMakePath, [$transformation]); | 
                                                                                                            
                                                            | 247 | 247 |                      } | 
                                                                                                                                                        
                                                        |  | @@ -321,13 +321,13 @@  discard block | 
                                                    
                                                        |  |  |  block discarded – undo | 
                                                                                                                                                                                                                    
                                                            | 321 | 321 |      { | 
                                                                                                            
                                                            | 322 | 322 |          if (!static::$transformationsByCRSPair) { | 
                                                                                                            
                                                            | 323 | 323 |              foreach (CRSTransformations::getSupportedTransformations() as $key => $transformation) { | 
                                                                                                            
                                                            | 324 |  | -                if (!isset(static::$transformationsByCRSPair[$transformation['source_crs'] . '|' . $transformation['target_crs']][$key])) { | 
                                                                                                            
                                                            | 325 |  | -                    static::$transformationsByCRSPair[$transformation['source_crs'] . '|' . $transformation['target_crs']][$key] = $transformation; | 
                                                                                                            
                                                            | 326 |  | -                    static::$transformationsByCRSPair[$transformation['source_crs'] . '|' . $transformation['target_crs']][$key]['in_reverse'] = false; | 
                                                                                                            
                                                            |  | 324 | +                if (!isset(static::$transformationsByCRSPair[$transformation['source_crs'].'|'.$transformation['target_crs']][$key])) { | 
                                                                                                            
                                                            |  | 325 | +                    static::$transformationsByCRSPair[$transformation['source_crs'].'|'.$transformation['target_crs']][$key] = $transformation; | 
                                                                                                            
                                                            |  | 326 | +                    static::$transformationsByCRSPair[$transformation['source_crs'].'|'.$transformation['target_crs']][$key]['in_reverse'] = false; | 
                                                                                                            
                                                            | 327 | 327 |                  } | 
                                                                                                            
                                                            | 328 |  | -                if ($transformation['reversible'] && !isset(static::$transformationsByCRSPair[$transformation['target_crs'] . '|' . $transformation['source_crs']][$key])) { | 
                                                                                                            
                                                            | 329 |  | -                    static::$transformationsByCRSPair[$transformation['target_crs'] . '|' . $transformation['source_crs']][$key] = $transformation; | 
                                                                                                            
                                                            | 330 |  | -                    static::$transformationsByCRSPair[$transformation['target_crs'] . '|' . $transformation['source_crs']][$key]['in_reverse'] = true; | 
                                                                                                            
                                                            |  | 328 | +                if ($transformation['reversible'] && !isset(static::$transformationsByCRSPair[$transformation['target_crs'].'|'.$transformation['source_crs']][$key])) { | 
                                                                                                            
                                                            |  | 329 | +                    static::$transformationsByCRSPair[$transformation['target_crs'].'|'.$transformation['source_crs']][$key] = $transformation; | 
                                                                                                            
                                                            |  | 330 | +                    static::$transformationsByCRSPair[$transformation['target_crs'].'|'.$transformation['source_crs']][$key]['in_reverse'] = true; | 
                                                                                                            
                                                            | 331 | 331 |                  } | 
                                                                                                            
                                                            | 332 | 332 |              } | 
                                                                                                            
                                                            | 333 | 333 |          } |