/** * @param string $gkey * @param string $pkey */ static function addGroupPlans($source, $gkey, $pkey, $target = null) { $okey = str_replace('_req', '_req_enabled', $pkey); if (!is_array($source[$pkey]) || empty($source[$okey])) { $plans = array(); } else { $plans = $source[$pkey]; } $newplans = ItemGroupHandler::getGroupsPlans($source[$gkey]); $plans = array_merge($plans, $newplans); $plans = array_unique($plans); if (is_null($target)) { $restrictions[$pkey] = $plans; return $restrictions; } else { $target[$pkey] = $plans; return $target; } }