Skip to content

Commit

Permalink
setting new fields on GCPFile for bucket info
Browse files Browse the repository at this point in the history
  • Loading branch information
Luizao committed Dec 17, 2021
1 parent 2134e6c commit 9c8b8c0
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/Duffer/GCSDuffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,12 @@ public function upload()
$bucketObj = $bucket->upload($fileToUpload->getBytes(), [
'name' => $fileName
]);

$fileToUpload->setId($bucketObj->info()['id']);
$fileToUpload->setSelfLink($bucketObj->info()['selfLink']);
//self::STORAGE_URI . $this->bucketName . '/' . ($bucketObj->name() ? $bucketObj->name() : $fileName)
$fileToUpload->setContentType($bucketObj->info()['contentType']);
$fileToUpload->setSize($bucketObj->info()['size']);
$fileToUpload->setTimeCreated($bucketObj->info()['timeCreated']);
$fileToUpload->setResultPath($bucketObj->info()['mediaLink']);
$fileToUpload->setStatus(File::FINISHED);
} catch (\Exception $e) {
Expand Down
62 changes: 61 additions & 1 deletion src/Files/GCSFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,72 @@ public function getBucket()
}

/**
* Get files bucket name
* Set files bucket name
*
* @return string
*/
public function setBucket(string $name)
{
$this->bucket = $bucket;
}

/**
* Get file content-type
*
* @return string
*/
public function getContentType()
{
return $this->contentType;
}

/**
* Set file content-type
*
* @return string
*/
public function setContentType(string $contentType)
{
$this->contentType = $contentType;
}

/**
* Get file size
*
* @return string
*/
public function getSize()
{
return $this->size;
}

/**
* Get file size
*
* @return string
*/
public function setSize(string $size)
{
$this->size = $size;
}

/**
* Get file of creating on bucket
*
* @return string
*/
public function getTimeCreated()
{
return $this->timeCreated;
}

/**
* Set file of creating on bucket
*
* @return string
*/
public function setTimeCreated(string $timeCreated)
{
$this->timeCreated = $timeCreated;
}
}

0 comments on commit 9c8b8c0

Please sign in to comment.