core-bundle/src/Framework/ScopeAwareTrait.php
private function isScope(string $scope): bool
    {
        if (
            null === $this->container
            || null === ($request = $this->container->get('request_stack')->getCurrentRequest())
        ) {
            return false;
        }

        $matcher = $this->container->get('contao.routing.scope_matcher');

        if (ContaoCoreBundle::SCOPE_BACKEND === $scope) {
            return $matcher->isBackendRequest($request);
        }

        if (ContaoCoreBundle::SCOPE_FRONTEND === $scope) {
            return $matcher->isFrontendRequest($request);
        }

        return false;
    }
private function isScope(string $scope): bool
    {
        if (
            null === $this->container
            || null === ($request = $this->container->get('request_stack')->getCurrentRequest())
        ) {
            return false;
        }

        $matcher = $this->container->get('contao.routing.scope_matcher');

        if (ContaoCoreBundle::SCOPE_BACKEND === $scope) {
            return $matcher->isBackendRequest($request);
        }

        if (ContaoCoreBundle::SCOPE_FRONTEND === $scope) {
            return $matcher->isFrontendRequest($request);
        }

        return false;
    }
Checks whether the _scope attributes matches a scope.