Format the local scopes array

@param  \League\OAuth2\Server\Entity\Scope[]

@return array
971361
private function formatScopes($unformatted = [])
    {
        $scopes = [];
        if (is_array($unformatted)) {
            foreach ($unformatted as $scope) {
                if ($scope instanceof ScopeEntity) {
                    $scopes[$scope->getId()] = $scope;
                }
            }
        }

        return $scopes;
    }
1161694
public function scopes()
    {
        $scopes = $this->properties->get('scopes');

        if (str_contains($scopes, ',')) {
            $scopes = explode(',', $this->properties->get('scopes'));

            return implode("', '", $scopes);
        }

        return $scopes;
    }
1082019
protected function validateScope(ClientInterface $client, array $scopes = null): array
    {
        if (empty($scopes) === true) {
            $clientScopes = $client->getScopeIdentifiers();
            $isModified   = $clientScopes !== $scopes;

            return $client->isUseDefaultScopesOnEmptyRequest() === true ?
                [true, $clientScopes, $isModified] : [false, $scopes, false];
        }

        $extraScopes    = array_diff($scopes, $client->getScopeIdentifiers());
        $hasExtraScopes = count($extraScopes) > 0;
        $isInvalidScope = $hasExtraScopes === true && $client->isScopeExcessAllowed() === false;

        return $isInvalidScope === true ? [false, $scopes, false] : [true, $scopes, false];
    }
706384
public function getDisplayLocales()
    {
        $locales = array();

        foreach ($this->allowedLocales as $locale) {
            $locales[$locale] = \Locale::getDisplayName($locale);
        }

        return $locales;
    }
1184201
public function getScopes(AuthCodeEntity $token)
    {
        $result = $this->getDbConnection()->fetchAll(
            <<<SQL
SELECT s.id, s.description FROM oauth_auth_code_scope acs
INNER JOIN oauth_scope s ON(s.id=acs.oauth_scope)
WHERE auth_code = :authCode
SQL
            , [
                'authCode' => $token->getId()
            ]
        );
        $response = [];

        foreach($result as $row) {
            $response[] = (new ScopeEntity($this->server))->hydrate([
                'id' => $row['id'],
                'description' => $row['description']
            ]);
        }

        return $response;
    }
340530
protected static function _initScopes() {
		static::$_scopes = static::_instance('configuration');

		static::$_scopes->initConfig = function($name, $config) {
			$defaults = [
				'absolute' => false,
				'host' => null,
				'scheme' => null,
				'base' => null,
				'prefix' => '',
				'pattern' => '',
				'values' => [],
				'library' => $name
			];

			$config += $defaults;

			if (!$config['pattern']) {
				$config = static::_compileScope($config);
			}
			$config['base'] = $config['base'] ? trim($config['base'], '/') : $config['base'];
			return $config;
		};
	}
598331
public function getAuthenticationScopes(): array
    {

        // If we don't have any authentication data, then
        // only public calls can be made.
        if (is_null($this->getAuthentication()))
            return ['public'];

        // If there are no scopes that we know of, update them.
        // There will always be at least 1 as we add the internal
        // 'public' scope.
        if (count($this->getAuthentication()->scopes) <= 0)
            $this->setAuthenticationScopes();

        return $this->getAuthentication()->scopes;
    }
562193
protected function _scope($entity) {
		$scope = [];
		foreach ($this->_config['scope'] as $key => $value) {
			if (is_numeric($key)) {
				if (isset($entity, $value)) {
					$scope[$value] = $entity->$value;
				} else {
					$message = "The `{$value}` scope in not present in the entity.";
					throw new UnexpectedValueException($message);
				}
			} else {
				$scope[$key] = $value;
			}
		}
		return $scope;
	}
707016
public function all($scopes = []) {
        return $this->_get('servers/' . $this->server_id . '/software/' . $this->software_id . '/exploits', null, $scopes);
    }
1034232
public function getLocalPrimaryKeys()
    {
        $cols = [];
        $localCols = $this->getLocalColumnObjects();

        foreach ($localCols as $localCol) {
            if ($localCol->isPrimaryKey()) {
                $cols[] = $localCol;
            }
        }

        return $cols;
    }
284726
private function scopes()
    {
        $scopes = [];

        foreach ($this->products() as $product => $scope) {
            if (!$this->confirm(sprintf('Would you like to activate %s?', $product), true)) {
                continue;
            }

            array_push($scopes, $scope);
        }

        if (!count($scopes)) {
            $this->error('You have to select at least one scope');

            return $this->scopes();
        }

        return $scopes;
    }
240667
public function read($scope = null)
    {
        $scope = $scope === null ? ContainerScopeInterface::SCOPE_DEFAULT : $scope;
        if ($scope !== ContainerScopeInterface::SCOPE_DEFAULT) {
            throw new \Magento\Framework\Exception\LocalizedException(__("Only default scope allowed"));
        }

        $config = $this->initialConfig->getData($scope);

        $collection = $this->collectionFactory->create(
            ['scope' => $scope]
        );

        $dbDefaultConfig = [];
        foreach ($collection as $item) {
            $dbDefaultConfig[$item->getPath()] = $item->getValue();
        }

        $dbDefaultConfig = $this->converter->convert($dbDefaultConfig);
        $config = array_replace_recursive($config, $dbDefaultConfig);

        return $config;
    }
354571
public function processNode(Node $node, Scope $scope): array
    {
        if (0 === \count($node->params)) {
            return [];
        }

        $params = \array_filter($node->params, static function (Node\Param $node): bool {
            if (!$node->default instanceof Node\Expr\ConstFetch) {
                return false;
            }

            return 'null' === $node->default->name->toLowerString();
        });

        if (0 === \count($params)) {
            return [];
        }

        $methodName = $node->name->toString();

        /** @var Reflection\ClassReflection $classReflection */
        $classReflection = $scope->getClassReflection();

        if ($classReflection->isAnonymous()) {
            return \array_map(static function (Node\Param $node) use ($methodName): string {
                /** @var Node\Expr\Variable $variable */
                $variable = $node->var;

                /** @var string $parameterName */
                $parameterName = $variable->name;

                return \sprintf(
                    'Method %s() in anonymous class has parameter $%s with null as default value.',
                    $methodName,
                    $parameterName
                );
            }, $params);
        }

        $className = $classReflection->getName();

        return \array_map(static function (Node\Param $node) use ($className, $methodName): string {
            /** @var Node\Expr\Variable $variable */
            $variable = $node->var;

            /** @var string $parameterName */
            $parameterName = $variable->name;

            return \sprintf(
                'Method %s::%s() has parameter $%s with null as default value.',
                $className,
                $methodName,
                $parameterName
            );
        }, $params);
    }
424501
public function toArray()
    {
        $remotes = [];

        foreach ($this->remotes as $remote) {
            $remotes[] = $remote->toArray();
        }

        return [
            'branch' => $this->branch,
            'head' => $this->head->toArray(),
            'remotes' => $remotes,
        ];
    }
549838
public function scopes(array $scopes)
    {
        $builder = $this;

        foreach ($scopes as $scope => $parameters) {
            // If the scope key is an integer, then the scope was passed as the value and
            // the parameter list is empty, so we will format the scope name and these
            // parameters here. Then, we'll be ready to call the scope on the model.
            if (is_int($scope)) {
                [$scope, $parameters] = [$parameters, []];
            }

            // Next we'll pass the scope callback to the callScope method which will take
            // care of grouping the "wheres" properly so the logical order doesn't get
            // messed up when adding scopes. Then we'll return back out the builder.
            $builder = $builder->callScope(
                [$this->model, 'scope'.ucfirst($scope)],
                (array) $parameters
            );
        }

        return $builder;
    }
93214
function scope($scope) {
        $styles  = (array) Arr::get($this->scopes, $scope . '.css', []);
        $scripts = (array) Arr::get($this->scopes, $scope . '.js', []);
        foreach($styles as $style) {
            $this->css($style);
        }
        foreach($scripts as $script) {
            $this->js($script);
        }
        
        return $this;
    }
277402
protected function getScopeCounts()
    {
        if ( ! $this->areScopesEnabled()) {
            return [];
        }

        $info = $this->getModelInformation();

        if ( ! $info->list->scopes || ! count($info->list->scopes)) {
            // @codeCoverageIgnoreStart
            return [];
            // @codeCoverageIgnoreEnd
        }

        $counts = [];

        $repository = $this->getModelRepository();

        foreach (array_keys($info->list->scopes) as $key) {

            $this->applyScope($repository, $key);

            $query = $this->getModelRepository()->query();

            $this->applyListParentToQuery($query);

            $counts[ $key ] = $query->count();
        }

        return $counts;
    }