src/Web/Sessions/SessionArchiveInFiles.php
public function get($id, $remove = false)
    {
        $self = $this;
        /** @var File $file */
        $file = null;
        $getPromise = $this->getArchiveFilePath($id, true)->then(
            function($filePath) use (&$file) {
                $file = \Reaction::$app->fs->file($filePath);
                return $file->exists()->then(
                    function() use (&$file) {
                        return $file->open('r');
                    }
                );
            }
        )->then(
            function($stream = null) use (&$file) {
                return $file->getContents();
            }
        )->then(
            function($dataStr) use ($self, &$file, $remove) {
                try {
                    $data = $self->getHandler()->unserializeData($dataStr);
                } catch (\InvalidArgumentException $exception) {
                    $data = null;
                }
                $data = is_array($data) ? $data : null;
                if ($remove) {
                    $callback = function() use ($data) { return $data; };
                    return $file->remove()->then($callback, $callback);
                }
                return $data;
            },
            function() use ($id) {
                $message = sprintf('Failed to restore session "%s"', $id);
                throw new SessionException($message);
            }
        );
        return resolve($getPromise);
    }
public function get($id, $remove = false)
    {
        $self = $this;
        /** @var File $file */
        $file = null;
        $getPromise = $this->getArchiveFilePath($id, true)->then(
            function($filePath) use (&$file) {
                $file = \Reaction::$app->fs->file($filePath);
                return $file->exists()->then(
                    function() use (&$file) {
                        return $file->open('r');
                    }
                );
            }
        )->then(
            function($stream = null) use (&$file) {
                return $file->getContents();
            }
        )->then(
            function($dataStr) use ($self, &$file, $remove) {
                try {
                    $data = $self->getHandler()->unserializeData($dataStr);
                } catch (\InvalidArgumentException $exception) {
                    $data = null;
                }
                $data = is_array($data) ? $data : null;
                if ($remove) {
                    $callback = function() use ($data) { return $data; };
                    return $file->remove()->then($callback, $callback);
                }
                return $data;
            },
            function() use ($id) {
                $message = sprintf('Failed to restore session "%s"', $id);
                throw new SessionException($message);
            }
        );
        return resolve($getPromise);
    }
Get data from archive
@param string $id Session id
@param bool   $remove Flag to remove data
@return ExtendedPromiseInterface with data array