Neos\Flow\Session\Session::resume PHP Method

resume() public method

Resumes an existing session, if any.
public resume ( ) : integer
return integer If a session was resumed, the inactivity of since the last request is returned
    public function resume()
    {
        if ($this->started === false && $this->canBeResumed()) {
            $this->sessionIdentifier = $this->sessionCookie->getValue();
            $this->response->setCookie($this->sessionCookie);
            $this->started = true;
            $sessionObjects = $this->storageCache->get($this->storageIdentifier . md5('TYPO3_Flow_Object_ObjectManager'));
            if (is_array($sessionObjects)) {
                foreach ($sessionObjects as $object) {
                    if ($object instanceof ProxyInterface) {
                        $objectName = $this->objectManager->getObjectNameByClassName(get_class($object));
                        if ($this->objectManager->getScope($objectName) === ObjectConfiguration::SCOPE_SESSION) {
                            $this->objectManager->setInstance($objectName, $object);
                            $this->objectManager->get(Aspect\LazyLoadingAspect::class)->registerSessionInstance($objectName, $object);
                        }
                    }
                }
            } else {
                // Fallback for some malformed session data, if it is no array but something else.
                // In this case, we reset all session objects (graceful degradation).
                $this->storageCache->set($this->storageIdentifier . md5('TYPO3_Flow_Object_ObjectManager'), [], [$this->storageIdentifier], 0);
            }
            $lastActivitySecondsAgo = $this->now - $this->lastActivityTimestamp;
            $this->lastActivityTimestamp = $this->now;
            return $lastActivitySecondsAgo;
        }
    }