@param StepRegistration[] $registrations

@return array
500840
private function groupRegistrationsByStage(array $registrations)
    {
        $stages = [];
        foreach ($registrations as $registration) {
            /** @var PipelineStepInterface $stepClass */
            $stepClass = $registration->getStepFqcn();
            $stageName = $stepClass::getStageContextClass();

            if (!isset($stages[$stageName])) {
                $stages[$stageName] = [];
            }

            $stages[$stageName][] = $registration;
        }

        return $stages;
    }
835319
public function readRegistration(RegistrationInterface $registration)
    {
        if (!$registration->getRegistrationId()) {
            throw new \RuntimeException('Registration ID is mandatory.');
        }

        $uri = $registration->buildUri($this->endpoint, $this->hubPath).self::API_VERSION;

        $token = $this->generateSasToken($uri);
        $headers = array_merge(['Authorization: '.$token], $registration->getHeaders());

        $response = $this->request(self::METHOD_GET, $uri, $headers);

        return $registration->scrapeResponse($response);
    }
164063
private function getOrganizeMigrationsModes() : array
    {
        $constPrefix = 'VERSIONS_ORGANIZATION_';
        $prefixLen   = strlen($constPrefix);
        $refClass    = new ReflectionClass('Doctrine\Migrations\Configuration\Configuration');
        $constsArray = $refClass->getConstants();
        $namesArray  = [];

        foreach ($constsArray as $key => $value) {
            if (strpos($key, $constPrefix) !== 0) {
                continue;
            }

            $namesArray[] = substr($key, $prefixLen);
        }

        return $namesArray;
    }
487821
private function getMapSecurityIdentities(array $sids)
    {
        $connection = $this->entityManager->getConnection();
        $mapSids = [];

        foreach ($sids as $sid) {
            $type = $this->sharingManager->getIdentityConfig($sid->getType())->getType();
            $mapSids[$type][] = $connection->quote($sid->getIdentifier());
        }

        foreach ($mapSids as $type => $ids) {
            $mapSids[$type] = implode(', ', $ids);
        }

        return $mapSids;
    }
1248574
public function setRegistrationTokens(array $registrationTokens): self
    {
        foreach ($registrationTokens as $registrationToken) {
            $this->addRegistrationToken($registrationToken);
        }

        return $this;
    }
820518
public static function setDefaultRegistries(array $registries)
    {
        self::$defaultRegistries = [];

        foreach ($registries as $registry) {
            if (array_key_exists($registry, self::$registries)) {
                self::$defaultRegistries[] = $registry;
            } else {
                throw new InvalidRegistryName($registry);
            }
        }
    }
409852
public synchronized Register[] getRegisters() {
        Register[] dest = new Register[registers.length];
        System.arraycopy(registers, 0, dest, 0, dest.length);
        return dest;
    }
1040818
private int doRegister(int registrations) {
        // adjustment to state
        long adjust = ((long)registrations << PARTIES_SHIFT) | registrations;
        final Phaser parent = this.parent;
        int phase;
        for (;;) {
            long s = (parent == null) ? state : reconcileState();
            int counts = (int)s;
            int parties = counts >>> PARTIES_SHIFT;
            int unarrived = counts & UNARRIVED_MASK;
            if (registrations > MAX_PARTIES - parties)
                throw new IllegalStateException(badRegister(s));
            phase = (int)(s >>> PHASE_SHIFT);
            if (phase < 0)
                break;
            if (counts != EMPTY) {                  // not 1st registration
                if (parent == null || reconcileState() == s) {
                    if (unarrived == 0)             // wait out advance
                        root.internalAwaitAdvance(phase, null);
                    else if (UNSAFE.compareAndSwapLong(this, stateOffset,
                                                       s, s + adjust))
                        break;
                }
            }
            else if (parent == null) {              // 1st root registration
                long next = ((long)phase << PHASE_SHIFT) | adjust;
                if (UNSAFE.compareAndSwapLong(this, stateOffset, s, next))
                    break;
            }
            else {
                synchronized (this) {               // 1st sub registration
                    if (state == s) {               // recheck under lock
                        phase = parent.doRegister(1);
                        if (phase < 0)
                            break;
                        // finish registration whenever parent registration
                        // succeeded, even when racing with termination,
                        // since these are part of the same "transaction".
                        while (!UNSAFE.compareAndSwapLong
                               (this, stateOffset, s,
                                ((long)phase << PHASE_SHIFT) | adjust)) {
                            s = state;
                            phase = (int)(root.state >>> PHASE_SHIFT);
                            // assert (int)s == EMPTY;
                        }
                        break;
                    }
                }
            }
        }
        return phase;
    }
1108781
public function registryAlias($registryAlias = null)
    {
        if ($registryAlias !== null) {
            $this->setRegistryAlias($registryAlias);
        }

        return $this->getRegistryAlias();
    }
1329954
public function loadRegistries()
    {
        $registries = $this->registryFactory->getDefaultRegistries();

        foreach ($registries as $registry) {
            $this->addRegistry($registry);
        }
    }
812065
public function register(array $registry)
	{
		foreach($registry as $key => $reg)
			$this->data[$key] = $reg;
	}
1307067
private function registrationTextOptions(): array
    {
        return [
            0 => I18N::translate('No predefined text'),
            1 => I18N::translate('Predefined text that states all users can request a user account'),
            2 => I18N::translate('Predefined text that states admin will decide on each request for a user account'),
            3 => I18N::translate('Predefined text that states only family members can request a user account'),
            4 => I18N::translate('Choose user defined welcome text typed below'),
        ];
    }
663224
public static function get_new_registration_fields() {
        $fieldsneedconfirm = [];
        if (!self::is_registered()) {
            // Nothing to update if site is not registered.
            return $fieldsneedconfirm;
        }

        $cleanhuburl = clean_param(HUB_MOODLEORGHUBURL, PARAM_ALPHANUMEXT);
        $lastupdated = (int)get_config('hub', 'site_regupdateversion_' . $cleanhuburl);
        foreach (self::CONFIRM_NEW_FIELDS as $version => $fields) {
            if ($version > $lastupdated) {
                $fieldsneedconfirm = array_merge($fieldsneedconfirm, $fields);
            }
        }
        return $fieldsneedconfirm;
    }
1175105
private function keyEntityArray(array $entities) : array
    {
        $keyedArray = [];

        foreach ($entities as $entity) {
            $keyedArray[$this->idAccessorRegistry->getEntityId($entity)] = $entity;
        }

        return $keyedArray;
    }
346734
public function createAccountAction(Registration $registration)
    {
        $accountIdentifier = $registration->getUsername();
        $existingAccount = $this->accountRepository->findActiveByAccountIdentifierAndAuthenticationProviderName($accountIdentifier, 'Neos.Neos:Backend');
        if ($existingAccount !== null) {
            $this->addFlashMessage('An account with the username "%s" already exists.', 'Account already exists', Message::SEVERITY_ERROR, array($accountIdentifier));
            $this->forward('newAccount');
        }

        $this->createTemporaryAccount($accountIdentifier, $registration->getPassword(), $registration->getFirstName(), $registration->getLastName());

        $uriBuilder = new UriBuilder();
        $uriBuilder->setRequest($this->request->getParentRequest());
        $redirectUri = $uriBuilder
            ->setCreateAbsoluteUri(true)
            ->uriFor('index', array('username' => $accountIdentifier), 'Login', 'Neos.Neos');
        $this->redirectToUri($redirectUri);
    }
348759
private function sort(array $stageSteps)
    {
        if (empty($stageSteps)) {
            return [];
        }

        $dependencyGraphBuilder = new StepDependencyGraphBuilder($stageSteps);
        return $dependencyGraphBuilder->build()->sort();
    }
623941
public void setRegisters(Register[] registers) {
        writeCount = registers != null ? registers.length : 0;
        this.registers = registers != null ? Arrays.copyOf(registers, registers.length) : null;
    }