private function loadFromFile(SessionInterface $session)
    {
        $id = preg_replace('/[^\w\-]+/', '-', $session->getId());
        $dir = (new Config())->getSessionDir();
        $filename = "$dir/sess-$id/sess-$id.json";
        if (is_readable($filename) && ($contents = file_get_contents($filename))) {
            $data = json_decode($contents, true) ?: [];
            $session->setData($data);
            $this->save($session);
            // Reload the session from the keychain, and delete the file if
            // successful.
            if (rename($filename, $filename . '.bak')) {
                $this->load($session);
                if ($session->getData()) {
                    unlink($filename . '.bak');
                }
            }
        }
    }
private function loadFromFile(SessionInterface $session)
    {
        $id = preg_replace('/[^\w\-]+/', '-', $session->getId());
        $dir = (new Config())->getSessionDir();
        $filename = "$dir/sess-$id/sess-$id.json";
        if (is_readable($filename) && ($contents = file_get_contents($filename))) {
            $data = json_decode($contents, true) ?: [];
            $session->setData($data);
            $this->save($session);
            // Reload the session from the keychain, and delete the file if
            // successful.
            if (rename($filename, $filename . '.bak')) {
                $this->load($session);
                if ($session->getData()) {
                    unlink($filename . '.bak');
                }
            }
        }
    }
private function loadFromFile ( SessionInterface $ session ) { $ id = preg_replace ( '/[^\w\-]+/' , '-' , $ session -> getId ( ) ) ; $ dir = ( new Config ( ) ) -> getSessionDir ( ) ; $ filename = "$dir/sess-$id/sess-$id.json" ; if ( is_readable ( $ filename ) && ( $ contents = file_get_contents ( $ filename ) ) ) { $ data = json_decode ( $ contents , true ) ? : [ ] ; $ session -> setData ( $ data ) ; $ this -> save ( $ session ) ; // Reload the session from the keychain, and delete the file if // successful. if ( rename ( $ filename , $ filename . '.bak' ) ) { $ this -> load ( $ session ) ; if ( $ session -> getData ( ) ) { unlink ( $ filename . '.bak' ) ; } } } }
Load the session from an old file for backwards compatibility.

@param \Platformsh\Client\Session\SessionInterface $session
Load the session from an old file for backwards compatibility .