Wait with getting the timezone from the server until we need it

This commit is contained in:
Robin Appelman 2015-03-13 13:12:00 +01:00
commit 476980d4ce
5 changed files with 72 additions and 15 deletions

View file

@ -17,15 +17,15 @@ use Icewind\SMB\Exception\NotFoundException;
class Parser {
/**
* @var string
* @var \Icewind\SMB\TimeZoneProvider
*/
protected $timeZone;
protected $timeZoneProvider;
/**
* @param string $timeZone
* @param \Icewind\SMB\TimeZoneProvider $timeZoneProvider
*/
public function __construct($timeZone) {
$this->timeZone = $timeZone;
public function __construct(TimeZoneProvider $timeZoneProvider) {
$this->timeZoneProvider = $timeZoneProvider;
}
public function checkForError($output, $path) {
@ -120,7 +120,7 @@ class Parser {
list(, $name, $mode, $size, $time) = $matches;
if ($name !== '.' and $name !== '..') {
$mode = $this->parseMode($mode);
$time = strtotime($time . ' ' . $this->timeZone);
$time = strtotime($time . ' ' . $this->timeZoneProvider->get());
$content[] = new FileInfo($basePath . '/' . $name, $name, $size, $time, $mode);
}
}