protected $scope = 'friends';
553646
protected function fetchAttributes()
	{
		$tokenData = $this->getAccessTokenData();
		$info = $this->makeSignedRequest('users.get.json', [
			'query' => [
				'uids' => $tokenData['params']['user_id'],
				//'fields' => '', // uid, first_name and last_name is always available
				'fields' => 'nickname, sex, bdate, city, country, timezone, photo, photo_medium, photo_big, photo_rec',
				'v' => self::API_VERSION,
			],
		]);

		$info = $info['response'][0];

		$this->attributes = $info;
		$this->attributes['id'] = $info['id'];
		$this->attributes['name'] = $info['first_name'] . ' ' . $info['last_name'];
		$this->attributes['url'] = 'http://vk.com/id' . $info['id'];

		if (!empty($info['nickname'])) {
			$this->attributes['username'] = $info['nickname'];
		} else {
			$this->attributes['username'] = 'id' . $info['id'];
		}

		$this->attributes['gender'] = $info['sex'] == 1 ? 'F' : 'M';

		if (!empty($info['timezone'])) {
			$this->attributes['timezone'] = timezone_name_from_abbr('', $info['timezone'] * 3600, date('I'));
		}

		return true;
	}
1316382
public function can($scope)
    {
        return in_array('*', $this->scopes) ||
               array_key_exists($scope, array_flip($this->scopes));
    }
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;
    }
456511
private function parseAutomatics($scope = 'always')
	{
		$automatics = array_merge($this->$scope, $this->always);

		if (!empty($automatics))
		{
			foreach ($automatics as $field)
			{
				if (strpos($field, '_'))
				{
					$bits   = explode('_', $field);
					$bits   = array_map('ucfirst', $bits);
					$method = implode('', $bits);
				}
				else
				{
					$method = ucfirst($field);
				}

				$method = 'automatic' . $method;
				// Pass the data to the method in case it needs to make use of another field's value
				$this->set($field, $this->$method($this->attributes));
			}
		}

		return $this;
	}
854879
public function & friends($count = null, $offset = null)
    {
        $result = array();

        // If we have authorized via one of social modules
        if (isset($this->active)) {
            // Call friends method on active social module
            $result = & $this->active->friends($count, $offset);
        }

        return $result;
    }
863809
public function isScope($scope, $key)
    {
        return isset($this->data[$scope][$key]) && $this->data[$scope][$key];
    }
233249
public static function get($key, $scope = self::DEFAULT_SCOPE)
    {
        if (isset(self::$storage[$scope][$key])) {
            return self::$storage[$scope][$key];
        }

        return null;
    }
1090056
public function setScope($scope)
    {
        if (empty($scope)) {
            return $this->clearScope();
        }

        session()->put($this->getSessionKey(static::TYPE_SCOPE), $scope);

        return $this;
    }
485378
public function scopeExists($scope)
    {
        // Check reserved scopes first.
        $scope = explode(' ', trim($scope));
        $reservedScope = $this->getReservedScopes();
        $nonReservedScopes = array_diff($scope, $reservedScope);
        if (count($nonReservedScopes) == 0) {
            return true;
        } else {
            // Check the storage for non-reserved scopes.
            $nonReservedScopes = implode(' ', $nonReservedScopes);

            return $this->storage->scopeExists($nonReservedScopes);
        }
    }
1329750
public static function oneByScope($scope_id, $scope)
	{
		return self::all()
			->whereEquals('scope_id', (int)$scope_id)
			->whereEquals('scope', (string)$scope)
			->row();
	}
952455
public function hasScope(string $scope): bool
    {
        // always return true if extensions not configured
        return !Group::create()->hasExtension(GroupExtension::class) || $this->getMember()->Groups()->filter([
            'Scopes.Name' => $scope
        ])->count() > 0;
    }
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()),
            ]);
        }
    }
1279902
public function run_befores($scope) {
    if ($this->_parent) {
      $this->_parent->run_befores($scope);
    }
    
    foreach ($this->_befores as $before) {
      $before($scope);
    }
  }
879246
public function find($scope)
    {
        if (strpos($scope, '.') === false) {
            $scope = $scope.'.'.AnInflector::singularize($scope);
        }

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

        return;
    }
989625
public function loadingJS($scope = false)
    {
        $assets = \Cake\Core\Configure::read('assets');
        
        if (!$scope) {
            $scope = ($this->request->param('prefix')) ? $this->request->param('prefix') : 'front';
        }
        
        $all = $this->fetchSetting();
        $css = Hash::extract($all, '{n}.js.base.{n}');
        $css = array_merge($css, Hash::extract($all, "{n}.js.{$scope}.{n}"));
  
        return $this->Html->script($css,['crossorigin'=> 'anonymous']);
    }
1135964
public function update(Queries\IScope $scope)
    {
        if ($this->scope === $scope) {
            return $this;
        }

        return new self($scope);
    }
279434
public function hasScope(Scope $scope)
    {
        foreach ($scope->toArray() as $scopeToken) {
            if (!$this->hasScopeToken($scopeToken)) {
                return false;
            }
        }

        return true;
    }