This method is intend to read a cookie with a previous stored locale-configuration (state).

@author Benjamin Carl <opensource@clickalicious.de>

@return bool TRUE on success, otherwise FALSE
7163
protected function readCookie()
    {
        if (isset($_COOKIE[self::$identifier])) {
            $storedSettings = explode(',', $_COOKIE[self::$identifier]);

            // locale
            if ($this->isValidLocaleCode($storedSettings[0]) &&
                $this->isValidLocaleCode($storedSettings[2]) &&
                $this->isValidLocaleCode($storedSettings[3])
            ) {
                $locale = [
                    'locale'   => $storedSettings[0],
                    'weight'   => (double) $storedSettings[1],
                    'language' => $storedSettings[2],
                    'country'  => $storedSettings[3],
                ];
            } else {
                $locale = null;
            }
        }

        // Return result
        return (isset($locale)) ? $locale : null;
    }
333358
public function hasNextState()
	{
		return $this->cacheIndexMap[$this->owner->{$this->stateAttribute}] + 1 < count($this->stateConfig);
	}
518918
public function getCookieToken()
    {
        // If we have accessed the cookie token this request already.
        if ($this->cookieToken !== null) {
            return $this->cookieToken;
        }

        $name = $this->config->getCookieName();
        $plain = '';
        if (isset($_COOKIE[$name])) {
            $encrypted = $_COOKIE[$name]; // Read encrypted cookie.
            $plain = Encryption::decrypt($encrypted, $this->config->getSecretKey());  // Decrypt cookie.
        }
        $this->cookieToken = $plain; // Don't access cookie again.

        return $plain;
    }
370817
public function getLocale()
    {
        $auth = $this->getView()
                     ->authentication();

        if ( $auth->hasIdentity() )
        {
            $locale = $auth->getIdentity()->locale;
        }
        else
        {
            $locale = Locale::getDefault();
        }

        return $locale;
    }
193614
private function unsetRememberMe(): bool {
		
		$this->rememberMe = NULL;
		if (!$this->store()) {
			return FALSE;
		}
		
		return setcookie(static::getRememberMeCookieName(), '', -1, '/');
		
	}
189739
protected function usingCookieSessions()
    {
        if (! $this->sessionConfigured()) {
            return false;
        }

        $handler = $this->manager->driver()->getHandler();

        if ($handler instanceof LockingSessionHandler) {
            return $handler->usingCookieSessions();
        }

        return parent::usingCookieSessions();
    }
1254937
protected function validateCountryState()
    {
        $id = $this->getUpdatingId();

        if ($id === false) {
            return null;
        }

        $data = $this->state->get($id);

        if (empty($data)) {
            $this->setErrorUnavailable('update', $this->translation->text('Country state'));
            return false;
        }

        $this->setUpdating($data);
        return true;
    }
1175395
public function read()
    {
        if (isset($_SESSION[static::SESSION_NAME])) {
            $sess_table = $this->_uncrypt($_SESSION[static::SESSION_NAME]);
            if (isset($sess_table[static::SESSION_ATTRIBUTESNAME])) {
                $this->attributes = $sess_table[static::SESSION_ATTRIBUTESNAME];
            }
        }
        $this->addSessionTable(static::SESSION_ATTRIBUTESNAME, $this->attributes);
        $this->is_loaded = true;
        return $this;
    }
1180238
protected function getDomainLocale()
    {
        $state = FluentState::singleton();

        // Ensure a domain is configured
        if (!$state->getIsDomainMode()) {
            return null;
        }
        $domain = $state->getDomain();
        if (!$domain) {
            return null;
        }

        // Get domain
        $domainObj = Domain::getByDomain($domain);
        if (!$domainObj) {
            return null;
        }

        // If the current domain has exactly one locale, the locale is non-ambiguous
        $locales = Locale::getCached()->filter('DomainID', $domainObj->ID);
        /** @var Locale $localeObject */
        $localeObject = $locales->first();
        if ($localeObject) {
            return $localeObject->getLocale();
        }

        return null;
    }
1210277
protected function readConfig() {
		$file = $this->path->getConfigPath() . '/translation.php';
		if (file_exists($file)) {
			$config = require($file);
			if (isset($config['translations'])) {
				$this->translations = $config['translations'];
			}
			if (isset($config['defaultLocale'])) {
				$this->setDefaultLocale($config['defaultLocale']);
			}
		}
		return $this;
	}
1289430
public function loadConfigurationCache(): bool
    {
        $cachePathAndFilename = $this->constructConfigurationCachePath();
        $configurations = @include $cachePathAndFilename;
        if ($configurations !== false) {
            $this->configurations = $configurations;
            return true;
        }

        return false;
    }
149821
public function read($id) {
    $crypto = $this->psl['crypt/crypto'];
    $store  = $this->psl['store'];

    /* If no cookie is set, just drop it! */
    if(!isset($_COOKIE[$this->name])) {
      return false;
    }

    /* Read from store and decrypt. */
    try {
      $sessData = $store->read('session', $_COOKIE[$this->name]);

      if($sessData !== false ) {
        $return = $crypto->decrypt($sessData, $this->secret);
      } else {
        $return = false;
      }
      return $return;
    }  catch (\phpSec\Exception $e) {
      return false;
    }
  }
239582
public function getIsLogin(){
        if(isset($_SESSION[$this->storeKey])) return true;
        if(!empty($_COOKIE[$this->storeKey])){
            $data = $this->authCode($_COOKIE[$this->storeKey],'DECODE');
            $this->identity = json_decode($data,true);
            $this->saveLoginSession();
        }
        return false;
    }
816118
protected function load()
    {
        $this->reset();

        $messages = $this->cookie->get($this->cookieKey);

        if ($messages) {
            $messages = json_decode($messages, true);

            if (!empty($messages[self::DURABLE])) {
                $this->messages[self::DURABLE] = $messages[self::DURABLE];
            }
            if (!empty($messages[self::NEXT])) {
                $this->messages[self::NOW] = $messages[self::NEXT];
            }

            $this->save();
        }

        return $this;
    }
914340
protected function getPersistLocale(HTTPRequest $request)
    {
        $key = $this->getPersistKey();

        // Skip persist if key is unset
        if (empty($key)) {
            return null;
        }

        // check session then cookies
        $session = $request->getSession();
        if ($session->isStarted() && ($locale = $session->get($key))) {
            return $locale;
        }

        if (static::config()->get('persist_cookie') && ($locale = Cookie::get($key))) {
            return $locale;
        }

        return null;
    }
1355213
protected function usingCookieSessions()
    {
        if (! $this->sessionConfigured()) {
            return false;
        }

        $session = $this->manager->driver();

        //
        $handler = $session->getHandler();

        return ($handler instanceof CookieSessionHandler);
    }
549018
public function proxyRead()
    {
        $proxyState = $this->proxyState;
        Client::debug('proxy readState: ', $proxyState);
        if ($proxyState === 2) {
            $buf = $this->read(2);
            if ($buf === "\x05\x00") {
                $this->proxyState = 5;
            } elseif ($buf === "\x05\x02") {
                $this->proxyState = 3;
            }
        } elseif ($proxyState === 4) {
            $buf = $this->read(2);
            if ($buf === "\x01\x00") {
                $this->proxyState = 5;
            }
        } elseif ($proxyState === 6) {
            $buf = $this->read(10);
            if (substr($buf, 0, 4) === "\x05\x00\x00\x01") {
                $this->proxyState = 0;
            }
        }
        return $proxyState !== $this->proxyState;
    }