Returns static registry instance.

@param  array $scope
@param  int   $options
@return static
340497
public static function getInstance(array $scope = [], $options = self::ACTION_ALL)
    {
        if (!is_object(self::$instance)) {
            self::$instance = new static($scope, $options);
        }

        return self::$instance;
    }
879246
public function find($scope)
    {
        if (strpos($scope, '.') === false) {
            $scope = $scope.'.'.AnInflector::singularize($scope);
        }

        if (isset($this[$scope])) {
            return $this[$scope];
        }

        return;
    }
303543
protected function scopes($scopes, array $options = [])
    {
        $scopes = $this->getPropertyValue($scopes);

        $this->scopes[] = \compact('scopes', 'options');
    }
224875
public function setScope($scope)
    {
        if (!is_array($scope)) {
            $this->_scope = explode(',', $scope);
        } else {
            $this->_scope = $scope;
        }

        return $this;
    }
501297
public static function instance($option = [])
    {
        $key = md5(get_called_class() . serialize($option));
        if (! isset(static::$instances[$key])) {
            $instance = new static($option);
            $instance->instance_key = $key;
            static::$instances[$key] = $instance;
        }
        return static::instanceGet($key);
    }
900735
public function scoped(Scope $scope)
	{
		if($scope instanceof Dependent)
		{
			$this->scope = NULL;
		}
		else
		{
			$this->scope = get_class($scope);
		}
		
		return $this;
	}
572686
public static function getScaffoldController(
        Controller $instance, $options = [])
    {

        $options = array_merge(
            [
                'controller' => $instance,
                'request' => $instance->request,
                'response' => $instance->response,
                'view' => $instance->view,
                'layout' => $instance->layout,
                'basePath' => $instance->basePath
            ],
            $options
        );
        return new static($options);
    }
755986
public function getItemConfigObject(array $options)
    {
        if ($this->type === 'settings') {
            return new SettingsConfig($this->validator, $this->customValidator, $options);
        } else {
            return new ModelConfig($this->validator, $this->customValidator, $options);
        }
    }
736411
public function scopeWhereSlug(Builder $scope, string $slug): Builder
    {
        return $scope->where($this->getSlugKeyName(), $slug);
    }
875876
public function addScope($scope)
    {
        if (!in_array($scope, $this->scopes)) {
            $this->scopes[] = $scope;
        }

        return $this;
    }
823605
protected function getModuleConfig(string $module, array $options = []): ModuleConfig
    {
        $mc = new ModuleConfig(ConfigType::FIELDS(), $module, null, ['cacheSkip' => true]);

        $schema = $mc->createSchema(['lint' => true]);
        $mc->setParser(new Parser($schema, ['lint' => true, 'validate' => true]));

        return $mc;
    }
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];
    }
95064
protected function callScope(callable $scope, $parameters = [])
    {
        array_unshift($parameters, $this);

        $query = $this->getQuery();

        // We will keep track of how many wheres are on the query before running the
        // scope so that we can properly group the added scope constraints in the
        // query as their own isolated nested where statement and avoid issues.
        $originalWhereCount = count($query->wheres);

        $result = $scope(...array_values($parameters)) ?: $this;

        if (count($query->wheres) > $originalWhereCount) {
            $this->addNewWheresWithinGroup($query, $originalWhereCount);
        }

        return $result;
    }
194552
public function getCollection(array $options = array())
    {
        /** @var ClientEntity[] $collection */
        $collection = $this->getRepository()->findAll();
        $resource   = new Resource($this->generateBrowseUrl(), array('count' => count($collection)));

        foreach ($collection as $element) {
            $resource->setEmbedded('client', $this->createResourceFromClient($element));
        }

        return $resource;
    }
567534
public static function scope(ScopeContract $scope = null)
    {
        if (! is_null($scope)) {
            return static::$scope = $scope;
        }

        if (is_null(static::$scope)) {
            static::$scope = new Scope;
        }

        return static::$scope;
    }
163687
public function getScopeType($scope = 'public')
    {
        switch ($scope) {
            case 'public':
                $type = \ReflectionMethod::IS_PUBLIC;
                break;
            case 'protected':
                $type = \ReflectionMethod::IS_PROTECTED;
                break;
            case 'private':
                $type = \ReflectionMethod::IS_PRIVATE;
                break;
        }

        return $type;
    }
817999
public static function registerScope($scope)
    {
        if ($scope instanceof Scope) {
            $class = get_called_class();
            static::$scopes[$class][$scope->getName()] = $scope;

            return true;
        }

        throw new \InvalidArgumentException('Global scope must be an instance of Scope.');
    }