This method translates given name of group based on associative array 'groupMapping' in SP metadata.
@param $request
@param string $groupName
@return string translated group name
336983
protected function mapGroupName($request, $groupName)
    {
        if (isset($request["SPMetadata"]["groupMapping"]) &&
            isset($request["SPMetadata"]["groupMapping"][$groupName])) {
            Logger::debug(
                "Mapping $groupName to " . $request["SPMetadata"]["groupMapping"][$groupName] .
                " for SP " . $request["SPMetadata"]["entityid"]
            );
            return $request["SPMetadata"]["groupMapping"][$groupName];
        } elseif (isset($request["SPMetadata"][self::GROUPNAMEPREFIX_ATTR])) {
            Logger::debug(
                "GroupNamePrefix overridden by a SP " . $request["SPMetadata"]["entityid"] .
                " to " . $request["SPMetadata"][self::GROUPNAMEPREFIX_ATTR]
            );
            return $request["SPMetadata"][self::GROUPNAMEPREFIX_ATTR] . $groupName;
        } else {
            # No mapping defined, so just put groupNamePrefix in front of the group
            Logger::debug(
                "No mapping found for group $groupName for SP " . $request["SPMetadata"]["entityid"]
            );
            return $this->groupNamePrefix . $groupName;
        }
    }
1133386
public function getActionAlias(Request $request): string
    {
        $actionAlias = str_replace('/', ':', $request->query->get('route'));

        if (empty($actionAlias)) {
            return $this->getConfiguration()->getDefaultController() . ':' . $this->getConfiguration()->getDefaultAction();
        }

        if (!strpos($actionAlias, ':')) {
            return $actionAlias . ':' . $this->getConfiguration()->getDefaultAction();
        }

        $aliases = array_keys($this->getQueryMap([]));

        foreach ($aliases as $alias) {
            if (strtolower($alias) === strtolower($actionAlias)) {
                $actionAlias = $alias;

                break;
            }
        }

        return $actionAlias;
    }
1067289
private function getMethodName($request) {
        $method = '';
        if(Director::isDev() && ($varMethod = $request->getVar('method'))) {
            if(in_array(strtoupper($varMethod), ['GET','POST','PUT','DELETE','HEAD', 'PATCH'])) {
                $method = $varMethod;
            }
        } else {
            $method = $request->httpMethod();
        }
        return strtolower($method);
    }
745034
private static function getCacheName(Request $request) {

        return md5((string)$request->getMethod().(string)$request->getUri());

    }
382703
public function getGroup($groupName)
    {
        return isset($this->groups[$groupName]) ? $this->groups[$groupName] : null;
    }
686941
public function getData(DataRequest $request)
    {
        $groupManager = $this->framework->getInstance('\\Zepi\\Web\\AccessControl\\Manager\\GroupManager');
        $groups = $groupManager->find($request);
        
        return $groups;
    }
529961
public function apply(Request $request)
    {
        if (IpUtils::checkIp($request->getClientIp(), $this->subnet)) {
            $name = $this->extractFieldInfo($request->headers, $this->headerField);
            if (!empty($name)) {
                return $name;
            }
        }

        return '';
    }
866245
public function groupAction($gname)
    {
        $group = $this->get('admin.configuration.configgroup_manager')->getRepository()->findOneByName($gname);
        if (!$group) {
            $message = $this->get('translator')->trans('The group with name "%name%" does not exist.', array('%name%'=>$gname), 'VinceTAdminConfigurationBundle');
            throw $this->createNotFoundException($message);
        }

        return $this->renderTemplate($group);
    }
769617
public function getGroupIdByName($name)
    {
        if (!isset($this->groups)) {
            $this->resetCraftSitesServiceGroupsCache();

            $this->groups = [];
            foreach (Craft::$app->sites->getAllGroups() as $group) {
                $this->groups[$group->name] = $group->id;
            }
        }
        if (!array_key_exists($name, $this->groups)) {
            $group = new SiteGroup(['name' => $name]);
            if (Craft::$app->sites->saveGroup($group)) {
                $this->groups[$name] = $group->id;
            } else {
                Schematic::importError($group, $name);

                return null;
            }
        }

        return $this->groups[$name];
    }
191032
public function index(Request $request)
    {
        $menuGroups = $this->menuGroupRepository->all();
        if ($request->get('group_id') == 'new') {
            $menuGroup = new MenuGroup;
            $menuGroup->name = 'New Group';
        } elseif ($request->get('group_id') > 0) {
            $menuGroup = $this->menuGroupRepository->find($request->get('group_id'));
        } else {
            $menuGroup = $this->menuGroupRepository
                ->query()
                ->whereIsDefault(1)
                ->first();
        }

        if (null === $menuGroup) {
            $menuGroup = new MenuGroup;
        }

        return view('avored-framework::cms.menu.index')
            ->withMenuGroups($menuGroups)
            ->withGroup($menuGroup);
    }
375446
public function byUsernameAction(Request $request)
   {
       $term = $request->get('username');
       $users = $this->get('asf_user.user.manager')->getRepository()->findByUsernameContains($term);
       $search = array();
       	
       foreach($users as $user) {
           $search[] = array(
               'id' => $user->getId(),
               'username' => $user->getUsername(),
               'email' => $user->getEmail()
           );
       }
       
       $response = new Response();
       $response->setContent(json_encode(array(
           'total_count' => count($search),
           'items' => $search
       )));
       
       return $response;
   }
1307486
public static function map_in_groups($groups = null)
    {
        $groupIDList = array();

        if ($groups instanceof SS_List) {
            foreach ($groups as $group) {
                $groupIDList[] = $group->ID;
            }
        } elseif (is_array($groups)) {
            $groupIDList = $groups;
        } elseif ($groups) {
            $groupIDList[] = $groups;
        }

        // No groups, return all Members
        if (!$groupIDList) {
            return static::get()->sort(array('Surname' => 'ASC', 'FirstName' => 'ASC'))->map();
        }

        $membersList = new ArrayList();
        // This is a bit ineffective, but follow the ORM style
        /** @var Group $group */
        foreach (Group::get()->byIDs($groupIDList) as $group) {
            $membersList->merge($group->Members());
        }

        $membersList->removeDuplicates('ID');

        return $membersList->map();
    }
439006
public function targetGroupAction(Request $request)
    {
        $currentTargetGroup = null;
        if ($request->headers->has($this->targetGroupHeader)) {
            $currentTargetGroup = $this->targetGroupRepository->find($request->headers->get($this->targetGroupHeader));
        }

        $targetGroup = $this->targetGroupEvaluator->evaluate(
            $currentTargetGroup ? TargetGroupRuleInterface::FREQUENCY_SESSION : TargetGroupRuleInterface::FREQUENCY_VISITOR,
            $currentTargetGroup
        );

        $response = new Response(null, 200, [
            $this->targetGroupHeader => $targetGroup ? $targetGroup->getId() : 0,
        ]);

        return $response;
    }
148361
protected function getRequestNamespacePath($request)
    {
        if (!$request instanceof Request) {
            $parentPath = $this->getRequestNamespacePath($request->getParentRequest());
            return $parentPath . ($parentPath !== '' && $request->getArgumentNamespace() !== '' ? '.' : '') . $request->getArgumentNamespace();
        }
        return '';
    }
690867
public function getStandingsAjaxElementName(Request $request)
    {

        $response = [
            'results' => [],
        ];

        if (strlen($request->input('search')) > 0) {

            try {

                // Resolve the Esi client library from the IoC
                $eseye = app('esi-client')->get();
                $eseye->setVersion('v2');
                $eseye->setQueryString([
                    'categories' => $request->input('type'),
                    'search'     => $request->input('search'),
                ]);

                $entityIds = $eseye->invoke('get', '/search/');

                if (! property_exists($entityIds, $request->input('type')))
                    return response()->json([]);

                if (count($entityIds->{$request->input('type')}) < 1)
                    return response()->json();

                collect($entityIds->{$request->input('type')})->unique()
                    ->filter(function ($id) use (&$response) {

                        // Next, filter the ids we have in the cache, setting
                        // the appropriate response values as we go along.
                        if ($cached_entry = cache('name_id:' . $id)) {

                            $response['results'][] = [
                                'id'   => $id,
                                'text' => $cached_entry,
                            ];

                            // Remove this as a valid id, we already have the value we want.
                            return false;
                        }

                        // We don't have this id in the cache. Return it
                        // so that we can update it later.
                        return true;

                    })->chunk(1000)->each(function ($chunk) use (&$response, $eseye) {

                        $eseye->setVersion('v2');
                        $eseye->setBody($chunk->flatten()->toArray());
                        $names = $eseye->invoke('post', '/universe/names/');

                        collect($names)->each(function ($name) use (&$response) {

                            // Cache the name resolution for this id for a long time.
                            cache(['name_id:' . $name->id => $name->name], carbon()->addCentury());

                            $response['results'][] = [
                                'id'   => $name->id,
                                'text' => $name->name,
                            ];
                        });

                    });

            } catch (Exception $e) {
            }
        }

        return response()->json($response);
    }
1288923
public function handleGroupAssignment($grid, $request) {
		$list = $grid->getList();
        
        // (copied from GridFieldOrderableRows::handleReorder)
		$modelClass = $grid->getModelClass();
		if ($list instanceof ManyManyList && !singleton($modelClass)->canView()) {
			$this->httpError(403);
		} else if(!($list instanceof ManyManyList) && !singleton($modelClass)->canEdit()) {
			$this->httpError(403);
		}
        //

		$item_id   = $request->postVar('groupable_item_id');
		$group_key   = $request->postVar('groupable_group_key');
        if($group_key=='none') $group_key = '';
		$item = $list->byID($item_id);
        $groupField = $this->getOption('groupField');

		// Update item with correct Group assigned (custom query required to write m_m_extraField)
//        DB::query(sprintf(
//            "UPDATE `%s` SET `%s` = '%s' WHERE `BlockID` = %d",
//            'SiteTree_Blocks',
//            'BlockArea',
//            $group_key,
//            $item_id
//        ));

        if ($list instanceof ManyManyList && array_key_exists($groupField, $list->getExtraFields())) {
            // update many_many_extrafields (MMList->add() with a new item adds a row, with existing item modifies a row)
            $list->add($item, array($groupField => $group_key));
        } else {
            // or simply update the field on the item itself
            $item->$groupField = $group_key;
            $item->write();
        }

        $this->extend('onAfterAssignGroupItems', $list);
        
        // Forward the request to GridFieldOrderableRows::handleReorder (if GridFieldOrderableRows)
        $orderableRowsComponent = $grid->getConfig()->getComponentByType('GridFieldOrderableRows');
        if($orderableRowsComponent) {
            return $orderableRowsComponent->handleReorder($grid, $request);
        } else {
            return $grid->FieldHolder();
        }

	}
940906
protected function getShortOsName(Request $request)
    {
        $os = strtolower($request->headers->get('User-Agent'));

        if(false !== strpos($os, 'linux'))
        {
           return 'linux';
        }

        if((false !== strpos($os, 'macintosh')) || (false !== strpos($os, 'mac os x')))
        {
            return 'mac';
        }

        return 'windows';
    }