$connection) { $area['connections'][$areaSlug]['name'] = json_decode(file_get_contents(__DIR__ . "/areas/$areaSlug.json"), true)['name']; } foreach ($area['locations'] ?? [] as $locationId => $location) { if ($location['type'] == 'shop') { $scoop = json_decode(file_get_contents(dirname(__DIR__) . "/modules/tuxemon/mods/tuxemon/db/economy/$location[economy].json"), true); array_unshift($area['locations'][$locationId]['items'], ...$scoop['items']); } } file_put_contents(__DIR__ . "/_generated/areas/$fileName.json", json_encode($area)); }