Return the state for the given identity

@throws IdentityNotManaged
184436
public function stateFor(Identity $identity): State
    {
        foreach ($this->states as $state => $entities) {
            if ($entities->contains($identity)) {
                return $state;
            }
        }

        throw new IdentityNotManaged;
    }
472775
def get_state(self, api=None):
        
        api = api or self._API
        return api.get(self._URL['state'].format(id=self.id)).json()
575275
def get_current_service_state(self, service_id: str):
        """"""
        state = self._get_service_state(service_id)
        return state.current_state
941854
public function get($id)
    {
        if (isset($this->cache[$id])) {
            return $this->cache[$id];
        }

        throw new NotFoundException('No entry was found for this identifier.');
    }
760234
public function getStates()
    {
        $appID = App::getCurrentID();
        $complementID = self::getCurrentID();
        $states = $this->getStatesFromFile();

        if (isset($states[$appID][$complementID])) {
            return $this->states = $states[$appID][$complementID];
        }

        return $this->states = [];
    }
1095113
@Override
    public long identity()
    {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "identity", this);
        if (tc.isEntryEnabled())
            Tr.exit(tc, "identity", new Long(_identity));
        return _identity;
    }
1068862
public State getMobileState() {
		if (connMan == null) {
			connMan = (ConnectivityManager) context
					.getSystemService(Context.CONNECTIVITY_SERVICE);
		}
		NetworkInfo mobileNetworkInfo = connMan.getNetworkInfo(TYPE_MOBILE);
		if (mobileNetworkInfo == null) {
			return State.UNKNOWN;
		}

		return mobileNetworkInfo.getState();
	}
1060403
def state(self):
        
        state = self.get_ps('persona_state', False)
        return EPersonaState(state) if state else EPersonaState.Offline
737996
public function getIdentity()
    {
        $identity = parent::getIdentity();

        if ( null !== $identity && ! $this->identityRefreshed )
        {
            $user = $this->getUserModel()
                         ->find( $identity->id );

            if ( ! empty( $user ) )
            {
                $this->getStorage()
                     ->write( $identity = $user );

                $this->identityRefreshed = true;
            }
        }

        return $identity;
    }
164321
private function login(Identity $identity, $sessionDuration = 0): bool
    {
        $returnUrl = $this->user->getReturnUrl();

        $result = $this->user->login($identity, $sessionDuration ? null : 0);
        if ($result && $returnUrl !== null) {
            $this->user->setReturnUrl($returnUrl);
        }

        return $result;
    }
467677
def get_self(self):
        
        response = self._send(http_method='GET',
                              location_id='4bb02b5b-c120-4be2-b68e-21f7c50a4b82',
                              version='5.0')
        return self._deserialize('IdentitySelf', response)
710894
public function getIdentityProperty()
    {
        if (is_string($this->_identity_property)) {
            $this->setIdentityProperty($this->_identity_property);
        }

        return $this->_identity_property;
    }
1292421
public function retrieveState($name = null)
    {
        $key = $this->generateKey(self::STATE_KEY);
        $state = self::storage()->get($key, []);
        if ($name !== null) {
            return isset($state[$name]) ? $state[$name] : null;
        }

        return $state;
    }
496430
public function detach(Identity $identity): self
    {
        $this->states = $this->states->map(static function(
            State $state,
            MapInterface $entities
        ) use (
            $identity
        ) {
            return $entities->remove($identity);
        });

        return $this;
    }
114118
def is_state(self, entity_id, state):
        """"""
        return remote.is_state(self.api, entity_id, state)
490836
public function findAll(Identity $identity = null)
    {
        if ($identity === null) {
            $identity = $this->getIdentity();
        }

        return $this
            ->_fetchAll($identity)
            ->_fetchCount($identity)
            ->_returnCollection();
    }
454186
public function getCurrentState()
    {
        foreach (array_values($this->states) as $state) { /* @var $state StateInterface */
            if ($state->hasToken()) {
                return $state;
            }
        }

        return null;
    }