Skip to content

Commit

Permalink
Merge pull request #9 from AndreasElia/fix/duplicate-structured-route
Browse files Browse the repository at this point in the history
Fix/duplicate structured route
  • Loading branch information
tomirons authored Feb 12, 2021
2 parents be67e9e + aa09bd1 commit f6f0c0f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ExportPostman.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ protected function ensurePath(array &$routes, array $segments, array $request, s
{
$parent = &$routes;

foreach ($segments as $segmentKey => $segment) {
foreach ($segments as $segment) {
$matched = false;

foreach ($parent['item'] as &$item) {
Expand All @@ -117,6 +117,7 @@ protected function ensurePath(array &$routes, array $segments, array $request, s
}

$matched = true;

break;
}
}
Expand All @@ -126,7 +127,7 @@ protected function ensurePath(array &$routes, array $segments, array $request, s
if (! $matched) {
$item = [
'name' => $segment,
'item' => $segmentKey !== 0 ? [$request] : [],
'item' => $segment === $destination ? [$request] : [],
];

$parent['item'][] = &$item;
Expand Down

0 comments on commit f6f0c0f

Please sign in to comment.