Skip to content

Commit

Permalink
GDrive: fix error when no properties are set
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisBirkholz committed Dec 30, 2018
1 parent 8035a33 commit 0a7ce5d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ final public function refreshConnection() : bool


/** @inheritdoc */
final public function fileFactory(string $fileName, FolderInterface $parent = null, string $id = null, int $size = null, string $md5 = null, array $properties = []) : FileInterface
final public function fileFactory(string $fileName, FolderInterface $parent = null, string $id = null, int $size = null, string $md5 = null, array $properties = null) : FileInterface
{
if ($this->fileFactory) {
$file = ($this->fileFactory)($this, $parent, $id, $fileName, $size, $md5, $properties);
Expand All @@ -228,7 +228,7 @@ final public function setFileFactory(callable $fileFactory)


/** @inheritdoc */
final public function folderFactory(string $folderName, FolderInterface $parent = null, string $id = null, array $properties = []) : FolderInterface
final public function folderFactory(string $folderName, FolderInterface $parent = null, string $id = null, array $properties = null) : FolderInterface
{
if ($this->folderFactory) {
$folder = ($this->folderFactory)($this, $parent, $id, $folderName, $properties);
Expand Down
7 changes: 5 additions & 2 deletions Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,19 @@ abstract class Entry implements EntryInterface
*/
public $properties;

/**
* @var Driver
*/
protected $driver;


public function __construct(Driver $driver, Folder $parent = null, string $id, string $name, array $properties = [])
public function __construct(Driver $driver, Folder $parent = null, string $id, string $name, array $properties = null)
{
$this->driver = $driver;
$this->parent = $parent;
$this->id = $id;
$this->name = $name;
$this->properties = $properties;
$this->properties = ($properties ?: []);

$parent->entries[$id] = $this;
}
Expand Down
2 changes: 1 addition & 1 deletion File.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class File extends Entry implements FileInterface
private $size;


public function __construct(Driver $driver, Folder $parent, string $id, string $name, int $size, string $md5, array $properties = [])
public function __construct(Driver $driver, Folder $parent, string $id, string $name, int $size, string $md5, array $properties = null)
{
parent::__construct($driver, $parent, $id, $name, $properties);
$this->size = $size;
Expand Down

0 comments on commit 0a7ce5d

Please sign in to comment.