Function to handle bc with code from pre 4.4 that does not know about scopes

@since 4.4
@param string|null $scope
@param string $identifier
@param string $dir
@param string $default
@return string
323047
protected static function selectOverrideScope( $scope, $identifier, $dir, $default )
    {
        if ( $scope !== null )
        {
            $def = self::defaultOverrideDirs();
            if ( isset( $def[$scope] ) )
                return $scope;
            eZDebug::writeWarning( "Undefined override dir scope: '$scope' with dir: '$dir'", __METHOD__ );
        }
        if ( $identifier === 'siteaccess' )
            return 'siteaccess';
        else if ( $identifier && strpos($identifier, 'extension:') === 0 )
            return 'extension';
        else if ( strpos($dir, 'siteaccess') !== false )
            return 'siteaccess';
        else if ( strpos($dir, 'extension') !== false )
            return 'extension';

        eZDebug::writeStrict( "Could not figgure out INI scope for \$identifier: '$identifier' with \$dir: '$dir', falling back to '$default'", __METHOD__ );
        return $default;
    }
233249
public static function get($key, $scope = self::DEFAULT_SCOPE)
    {
        if (isset(self::$storage[$scope][$key])) {
            return self::$storage[$scope][$key];
        }

        return null;
    }
73378
public function getContentById($identifier, $default = null)
    {
        if (empty($this->registry[$this->section][$identifier])) {

            $this->registry[$this->section][$identifier] = $this->getContentByIds(array($identifier));

            if (empty($this->registry[$this->section][$identifier])) {
                return $default;
            }
        }

        return $this->registry[$this->section][$identifier];
    }
933224
public function checkRegistered($provider_name, $identifier) {
        $user = $this->user_repository->findbyAuth($provider_name, $identifier);
        return ($user !== null);
    }
77686
public function get($identifier, $default = null)
    {
        $value = $this->internalGet($this->configsContainer, $identifier);

        if (is_null($value)) {
            return $default;
        }

        return $value;
    }
1117539
public function load($identifier, $name = null)
    {
        $name = $name ?: self::DEFAULT_NAME;

        $classname = config('shoppingcart.models.shoppingcart');
        $shoppingcart = $classname::firstOrNew($this->defaultValues($identifier, $name));

        return $shoppingcart;
    }
626238
public function getId($idScope = null)
    {
        if (empty($idScope)) {
            if (!is_null($this->resourceLink)) {
                $idScope = $this->resourceLink->getConsumer()->id_scope;
            } else {
                $idScope = ToolProvider::ID_SCOPE_ID_ONLY;
            }
        }
        switch ($idScope) {
            case ToolProvider::ID_SCOPE_GLOBAL:
                $id = $this->resourceLink->getKey() . ToolProvider::ID_SCOPE_SEPARATOR . $this->id;
                break;
            case ToolProvider::ID_SCOPE_CONTEXT:
                $id = $this->resourceLink->getKey();
                if ($this->resourceLink->lti_context_id) {
                    $id .= ToolProvider::ID_SCOPE_SEPARATOR . $this->resourceLink->lti_context_id;
                }
                $id .= ToolProvider::ID_SCOPE_SEPARATOR . $this->id;
                break;
            case ToolProvider::ID_SCOPE_RESOURCE:
                $id = $this->resourceLink->getKey();
                if ($this->resourceLink->lti_resource_id) {
                    $id .= ToolProvider::ID_SCOPE_SEPARATOR . $this->resourceLink->lti_resource_id;
                }
                $id .= ToolProvider::ID_SCOPE_SEPARATOR . $this->id;
                break;
            default:
                $id = $this->id;
                break;
        }

        return $id;
    }
693278
public function bindScopes(int $identifier, iterable $scopes): void
    {
        $getIdentifiers = function (iterable $scopes): iterable {
            foreach ($scopes as $scope) {
                /** @var ScopeInterface $scope */
                assert($scope instanceof ScopeInterface);
                yield $scope->getIdentifier();
            }
        };

        $this->bindScopeIdentifiers($identifier, $getIdentifiers($scopes));
    }
275006
public function bindScopeIdentifiers(int $identifier, iterable $scopeIdentifiers): void
    {
        try {
            $schema = $this->getDatabaseSchema();
            $this->createBelongsToManyRelationship(
                $identifier,
                $scopeIdentifiers,
                $schema->getTokensScopesTable(),
                $schema->getTokensScopesTokenIdentityColumn(),
                $schema->getTokensScopesScopeIdentityColumn()
            );
        } catch (RepositoryException $exception) {
            $message = 'Binding token scopes failed.';
            throw new RepositoryException($message, 0, $exception);
        }
    }
12448
public function readScopeIdentifiers(int $identifier): array
    {
        try {
            $schema = $this->getDatabaseSchema();
            return $this->readBelongsToManyRelationshipIdentifiers(
                $identifier,
                $schema->getTokensScopesTable(),
                $schema->getTokensScopesTokenIdentityColumn(),
                $schema->getTokensScopesScopeIdentityColumn()
            );
        } catch (RepositoryException $exception) {
            $message = 'Reading scopes for a token failed.';
            throw new RepositoryException($message, 0, $exception);
        }
    }
1219416
public static function scope($scope, $publickey = null, $secretkey = null)
    {
        return new OmiseSearch($scope, $publickey, $secretkey);
    }
895323
public static function oneByScope($scope, $scope_id)
	{
		return self::all()
			->whereEquals('scope', $scope)
			->whereEquals('scope_id', $scope_id)
			->ordered()
			->row();
	}
116591
public function getScope($scope, $key, $default = null)
    {
        return isset($this->data[$scope][$key]) ? $this->data[$scope][$key] : $default;
    }
458496
private function inflateType($identifier, $type = Scope::class)
    {
        if ($identifier === null) {
            return null;
        }

        return $this->entityManager->find($type, $identifier);
    }
1364138
public function retrieveById($identifier)
    {
        $user = parent::retrieveById($identifier);

        return $user && $user->hasGroup('sharp') ? $user : null;
    }
1137653
protected static Object getScopeService(IScope scope, String name, Class<?> defaultClass) {
        if (scope != null) {
            final IContext context = scope.getContext();
            ApplicationContext appCtx = context.getApplicationContext();
            Object result;
            if (!appCtx.containsBean(name)) {
                if (defaultClass == null) {
                    return null;
                }
                try {
                    result = defaultClass.newInstance();
                } catch (Exception e) {
                    log.error("{}", e);
                    return null;
                }
            } else {
                result = appCtx.getBean(name);
            }
            return result;
        }
        return null;
    }
67746
private function mapReservedScopeArray($id, array $config, $scope)
    {
        if (
            isset($config[$this->siteAccessNodeName][$scope][$id])
            && !empty($config[$this->siteAccessNodeName][$scope][$id])
        ) {
            $key = "$this->namespace.$scope.$id";
            $value = $config[$this->siteAccessNodeName][$scope][$id];
            if ($this->container->hasParameter($key)) {
                $value = array_merge(
                    $this->container->getParameter($key),
                    $value
                );
            }
            $this->container->setParameter($key, $value);
        }
    }