Overrides scope.

@param  array $scope
@return void
@throws \ReflectionException  Risen from self::checkPermissions().
960676
public function override(array $scope)
    {
        $this->checkPermissions(null, self::ACTION_OVERRIDE);
        $this->scope = $scope;
    }
928596
public function setScopes(Mutable $scopes = null)
    {
        if ($scopes && $scopes->count()) {
            $scopes->prepend(
                new Scope('all')
            );
        }

        $this->scopes = $scopes;

        return $this;
    }
896510
private function validateScopeValue($scope)
    {
        switch ($scope) {
            case self::SCOPE_ACT_AS_USER:
            case self::SCOPE_ADMIN:
            case self::SCOPE_NONE:
            case self::SCOPE_READ:
            case self::SCOPE_WRITE:
            case self::SCOPE_DELETE:
            case self::SCOPE_JIRA_PROJECT_ADMIN:
            case self::SCOPE_CONFLUENCE_SPACE_ADMIN:
                return true;
        }
        throw new \InvalidArgumentException(sprintf("Unknown scope %s", $scope));
    }
190539
public void setScope(String scope) {
        if (scope.equalsIgnoreCase("page")) {
            this.scope = PageContext.PAGE_SCOPE;
        } else if (scope.equalsIgnoreCase("request")) {
            this.scope = PageContext.REQUEST_SCOPE;
        } else if (scope.equalsIgnoreCase("session")) {
            this.scope = PageContext.SESSION_SCOPE;
        } else if (scope.equalsIgnoreCase("application")) {
            this.scope = PageContext.APPLICATION_SCOPE;
        }
        // TODO: Add error handling?  Needs direction from spec.
    }
695418
protected function callScope($scope, $parameters)
    {
        array_unshift($parameters, $this);

        return call_user_func_array(array($this->model, $scope), $parameters) ?: $this;
    }
48851
public function getScope($scope)
    {
        if (!isset($this->allScopes[$scope])) {
            throw new ApplicationException('No definition for scope ' . $scope);
        }

        return $this->allScopes[$scope];
    }
160366
public function with($scope)
	{
		$scope = is_array($scope) ? $scope : [$scope];

		$this->scopes = array_merge($this->scopes, $scope);

		return $this;
	}
879984
public function beforeScenario(BeforeScenarioScope $scope)
    {
        $environment = $scope->getEnvironment();

        if ($environment instanceof InitializedContextEnvironment) {
            $this->eventsContext = $environment->getContext(EventsContext::class);
        }
    }
859262
public static function flush($scope = null) {
		if (empty($scope)) {
			self::$implementedEvents = self::$loadedListeners = self::$loadedScopes = array();
			return;
		}

		// foreach (self::)
	}
1052363
public static function getGlobalScope($scope)
    {
        if (! is_string($scope)) {
            $scope = get_class($scope);
        }

        return array_get(static::$globalScopes, static::class.'.'.$scope);
    }
77337
public function delete($key)
    {
        $this->checkPermissions($key, self::ACTION_DELETE);
        unset($this->scope[$key]);
    }
875876
public function addScope($scope)
    {
        if (!in_array($scope, $this->scopes)) {
            $this->scopes[] = $scope;
        }

        return $this;
    }
1100698
public function setScope($scope)
  {
      if (!is_array($scope)) {
          $this->scopes = explode(' ', $scope);
      } else {
          $this->scopes = $scope;
      }

      return $this;
  }
1161128
public function setAll(array $vars)
    {
        foreach (self::$specialNames as $key) {
            unset($vars[$key]);
        }

        foreach (self::$commandScopeNames as $key) {
            unset($vars[$key]);
        }

        $this->scopeVariables = $vars;
    }
338935
public function restoreSorting(array $scope = []): void
    {
        $records = $this->_table->find()
            ->select([$this->_table->getPrimaryKey(), $this->getConfig('sortField')])
            ->select($this->getConfig('columnScope'))
            ->order($this->getConfig('defaultOrder'));

        if (!empty($scope)) {
            $records->where($scope);
        }

        $sorts = [];
        foreach ($records as $entity) {
            $individualScope = '';
            foreach ($this->getConfig('columnScope') as $column) {
                $individualScope .= $entity->get($column);
            }

            if (!isset($sorts[$individualScope])) {
                $sorts[$individualScope] = 0;
            }

            $sort = ++$sorts[$individualScope];
            $this->_table->updateAll([
                $this->getConfig('sortField') => $sort,
            ], [
                $this->_table->getPrimaryKey() => $entity->get($this->_table->getPrimaryKey()),
            ]);
        }
    }
960909
public function withScope($scope)
    {
        if ($scope == Grid\Exporter::SCOPE_ALL) {
            return $this;
        }

        list($scope, $args) = explode(':', $scope);

        if ($scope == Grid\Exporter::SCOPE_CURRENT_PAGE) {
            $this->grid->model()->usePaginate(true);
        }

        if ($scope == Grid\Exporter::SCOPE_SELECTED_ROWS) {
            $selected = explode(',', $args);
            $this->grid->model()->whereIn($this->grid->getKeyName(), $selected);
        }

        return $this;
    }
223411
public function setAuthenticationScopes()
    {

        $scopes = $this->verifyToken()['Scopes'];

        // Add the internal 'public' scope
        $scopes = $scopes . ' public';
        $this->authentication->scopes = explode(' ', $scopes);
    }