Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function read($sessionId)
 {
     $sessionData = [];
     if ($this->fileSystem->exists($this->sessionPath . '/' . $sessionId) && $this->fileSystem->isReadable($this->sessionPath . '/' . $sessionId)) {
         $sessionData = unserialize($this->fileSystem->getContents($this->sessionPath . '/' . $sessionId));
     }
     return $sessionData;
 }
Esempio n. 2
0
 /**
  * Constructor.
  *
  * @access  public
  * @param   string  $file     File path
  * @param   array   $options  Options
  */
 public function __construct($file, array $options = [])
 {
     $this->fileSystem = $this->getFileSystem();
     if ($this->fileSystem->exists($file) === false || $this->fileSystem->isReadable($file) === false) {
         throw new RuntimeException(vsprintf("%s(): File [ %s ] is not readable.", [__METHOD__, $file]));
     }
     $this->filePath = $file;
     $this->fileSize = $this->fileSystem->size($file);
     $this->options = $options + ['file_name' => basename($file), 'disposition' => 'attachment', 'content_type' => $this->fileSystem->mime($file) ?: 'application/octet-stream', 'callback' => null];
 }