Get a global scope registered with the model.

@param  \Illuminate\Database\Eloquent\Scope|string  $scope
@return \Illuminate\Database\Eloquent\Scope|\Closure|null
483122
public static function getGlobalScope($scope)
    {
        if (is_string($scope)) {
            return Arr::get(static::$globalScopes, static::class.'.'.$scope);
        }

        return Arr::get(
            static::$globalScopes, static::class.'.'.get_class($scope)
        );
    }
79807
public function removeScope($scope)
    {
        $this->validateScopeValue($scope);

        $key = $this->getScopeKey($scope);
        if (false === $key) {
            return $this;
        }

        unset($this->descriptor['scopes'][$key]);
        return $this;
    }
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;
    }
770573
public function getScope($key)
    {
        $scope = ('application' === $key) ? 'APPLICATION_CONFIG' : 'BUNDLE_CONFIG';

        if ($this->application->getContainer()->has('config.configurator')) {
            $scope = $this
                    ->application
                    ->getContainer()
                    ->get('config.configurator')
                    ->getRegistryScope($scope, $this->persistPerContext, $this->persistPerEnvironment)
            ;
        }

        return $scope;
    }
603184
public function getScopes(): array
    {
        if ($this->scopes === null) {
            $event = new RegisterScopesEvent([
                'scopes' => [
                    self::GLOBAL_SCOPE
                ]
            ]);

            $this->trigger(
                self::EVENT_REGISTER_SCOPES,
                $event
            );

            $this->scopes = $event->scopes;
        }

        return $this->scopes;
    }
151927
public function getNamespacesInScope( $scope = XmlNamespaceScope::All )
	{
		$namespaces = $this->namespaces;

		if ( $scope == XmlNamespaceScope::ExcludeXml )
		{
			// Make sure http://www.w3.org/XML/1998/namespace is not included
			if ( ( $prefix = $this->lookupPrefix( "http://www.w3.org/XML/1998/namespace" ) ) )
			{
				unset( $namespaces[ $prefix ] );
			}
		}
		return $namespaces;
	}
1219249
public function getScope()
    {
        $scope = $this->getData('scope');

        if ($scope === null) {
            $scope = ContainerScopeInterface::SCOPE_DEFAULT;

            if ($this->getContainerCode()) {
                $scope = ContainerScopeInterface::SCOPE_CONTAINERS;
            }
            if ($this->getStoreCode()) {
                $scope = ContainerScopeInterface::SCOPE_STORE_CONTAINERS;
            }

            $this->setScope($scope);
        }

        return $scope;
    }
631754
public static function attached($name = null) {
		if (!isset(static::$_scopes)) {
			static::_initScopes();
		}
		if ($name === false) {
			$name = '__defaultScope__';
		}
		return static::$_scopes->get($name);
	}
401892
public static function getGlobal(string $name)
    {
        if (isset(self::$globalOptions[$name])) {
            return self::$globalOptions[$name];
        } else {
            return null;
        }
    }
530594
public function newQueryWithoutScope($scope)
    {
        $this->getGlobalScope($scope)->remove($query = $this->getQuery(), $this);

        return $query;
    }
368588
public function push($scope)
    {
        if (! is_array($scope)) {
            $scope = func_get_args();
        }

        $this->scopes[] = $scope;

        return $this;
    }
1090102
public function getClassNamesByScope($scope)
    {
        if (!isset($this->cachedClassNamesByScope[$scope])) {
            foreach ($this->objects as $objectName => $information) {
                if ($information['s'] === $scope) {
                    if (isset($information['c'])) {
                        $this->cachedClassNamesByScope[$scope][] = $information['c'];
                    } else {
                        $this->cachedClassNamesByScope[$scope][] = $objectName;
                    }
                }
            }
        }
        return $this->cachedClassNamesByScope[$scope];
    }
433281
protected function getOwnScopes()/*# : array */
    {
        // result
        $result = [];

        // all types avaible
        $allTypes = $this->getAllTypes(static::getScopes());

        // loop thru own scopes
        foreach ($this->scopes as $scope) {
            $result[$scope] = true;
            $this->matchParentType($scope, $allTypes, $result);
        }

        // alway add global scope
        $result[''] = true;

        return array_keys($result);
    }
391400
public function purge($scope = null)
    {
        // Get scope if not passed
        if (null === $scope) {
            $scope = $this->getScope();
        }

        // Return result of purge
        return $this->getContainer()->purge($scope);
    }
24900
public function getScopeFilter($scope)
	{
		$filters = $this->getFilters();

		return isset($filters[$scope]) ? $filters[$scope] : null;
	}
1040792
public function clear($scope = null)
    {
        if ($scope === null) {
            $this->messages = array();
        } else {
            foreach ($this->messages as $key => $message) {
                if ($message['scope'] === $scope) {
                    unset($this->messages[$key]);
                }
            }
        }
        return $this;
    }
74501
protected function purgeScope($scope)
    {
        foreach ($scope as $name => $obj) {
            if ($obj instanceof Generic) {
                if ($obj->source === 'config' && ($obj->revision < $this->revision)) {
                    if (!$obj->resetToDefault()) {
                        unset($scope->{$name});
                    }
                }
            } elseif ($obj instanceof Section) {
                if ($obj->source === 'config' && ($obj->revision < $this->revision)) {
                    if ($obj->count() === 0) {
                        unset($scope->{$name});
                    } elseif (isset($obj->enable)) {
                        $obj->enable->setValue(false);
                    }
                }
            }
        }
    }