Add a validation scope

@param array 	$scope
@return ValidationInterface
160366
public function with($scope)
	{
		$scope = is_array($scope) ? $scope : [$scope];

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

		return $this;
	}
1203242
function addValidations(scope, validations) {
        for (var name in validations) {
            if (validations.hasOwnProperty(name) && validations[name]) {
                scope[name] = $injector.invoke(validations[name]);
            }
        }
    }
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.');
    }
66741
public function createAuthUrl($scope)
  {
    $params = array(
        'response_type' => 'code',
        'redirect_uri' => $this->client->getClassConfig($this, 'redirect_uri'),
        'client_id' => $this->client->getClassConfig($this, 'client_id'),
        'scope' => $scope,
        'access_type' => $this->client->getClassConfig($this, 'access_type'),
    );

    // Prefer prompt to approval prompt.
    if ($this->client->getClassConfig($this, 'prompt')) {
      $params = $this->maybeAddParam($params, 'prompt');
    } else {
      $params = $this->maybeAddParam($params, 'approval_prompt');
    }
    $params = $this->maybeAddParam($params, 'login_hint');
    $params = $this->maybeAddParam($params, 'hd');
    $params = $this->maybeAddParam($params, 'openid.realm');
    $params = $this->maybeAddParam($params, 'include_granted_scopes');

    // If the list of scopes contains plus.login, add request_visible_actions
    // to auth URL.
    $rva = $this->client->getClassConfig($this, 'request_visible_actions');
    if (strpos($scope, 'plus.login') && strlen($rva) > 0) {
        $params['request_visible_actions'] = $rva;
    }

    if (isset($this->state)) {
      $params['state'] = $this->state;
    }

    return self::OAUTH2_AUTH_URL . "?" . http_build_query($params, '', '&');
  }
553341
public function compile($definition)
    {
        $validator = new ExceptionValidator($definition->createValidator());
        $validator->validate($definition);

        // Try to compile map option
        // Just works if map is a validator
        try {
            $definition->map = $this->compiler->compile($definition->map);
        } catch (\RuntimeException $e) {
            // Ignore it if fails
            // Map could be a closure or anything else callable
        }

        return new ArrayValidator($definition->export());
    }
928596
public function setScopes(Mutable $scopes = null)
    {
        if ($scopes && $scopes->count()) {
            $scopes->prepend(
                new Scope('all')
            );
        }

        $this->scopes = $scopes;

        return $this;
    }
471057
public function setScope($scope)
    {
        if ($scope !== static::UNKNOWN_VALUE) {
            $this->scope = $scope;
            // Now that we have a scope, we can actually generate code to
            // reach the variables inside the analysis.
            $this->pool->codegenHandler->setAllowCodegen(true);
        }
    }
988328
public function validate(array $form) {
        $this->isValid = true;
        foreach($form as $field => $value) {
            if(array_key_exists($field , $this->validation )) {
                $this->validField($field , $value, $this->validation[$field]);
            }
        }
        return $this;
    }
1215554
public function setMergedGrantedScopes(array $scopes = null)
    {
        ValidationUtility::ensureNullOrArrayOfString('$scopes', $scopes);

        $this->mergedGrantedScopes = $scopes;

        return $this;
    }
1113815
private function createCreateForm(Scope $scope)
    {
        $form = $this->createForm(new ScopeType(), $scope, array(
            'action' => $this->generateUrl('admin_scope_create'),
            'method' => 'POST',
        ));

        $form->add('submit', 'submit', array('label' => 'Create'));

        return $form;
    }
1146422
public function validate($scope, $scopeId)
    {
        $valid = true;
        if ($scope === 'default') { // Default Store only valid for id 0
            if ($scopeId !== 0) {
                $valid = false;
            }
        } elseif ($scope === 'websites') { // Check if website with id exists
            $valid = $this->isValidWebsiteId($scopeId);
        } elseif ($scope === 'stores') { // Check if store with id exists
            $valid = $this->isValidStoreId($scopeId);
        }

        return $valid;
    }
416686
public static function getGlobalScope($scope)
    {
        return array_first(static::$globalScopes[get_called_class()], function($key, $value) use ($scope)
        {
            return $scope instanceof $value;
        });
    }
1316382
public function can($scope)
    {
        return in_array('*', $this->scopes) ||
               array_key_exists($scope, array_flip($this->scopes));
    }
1135964
public function update(Queries\IScope $scope)
    {
        if ($this->scope === $scope) {
            return $this;
        }

        return new self($scope);
    }
215234
public function hasScope($scope)
    {
        if ($this->scopes === null) {
            $this->getScopes();
        }

        return isset($this->scopes[$scope]);
    }
960676
public function override(array $scope)
    {
        $this->checkPermissions(null, self::ACTION_OVERRIDE);
        $this->scope = $scope;
    }
454469
function setScope($scope)
    {
        $scopes = array_merge($this->getScopes(), array( (string) $scope) );
        $this->setScopes($scopes);
        return $this;
    }