-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added
Entity/File
fo represent a file
- Loading branch information
Valentinas Bartusevičius
committed
Mar 8, 2021
1 parent
709e9a5
commit 70337bd
Showing
3 changed files
with
86 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
|
||
namespace Paysera\Component\RestClientCommon\Entity; | ||
|
||
/** | ||
* @api | ||
*/ | ||
class File extends Entity | ||
{ | ||
/** | ||
* @return string|null | ||
*/ | ||
public function getName() | ||
{ | ||
return $this->get('name'); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getContent() | ||
{ | ||
return $this->get('content'); | ||
} | ||
|
||
/** | ||
* @return string|null | ||
*/ | ||
public function getMimeType() | ||
{ | ||
return $this->get('mime_type'); | ||
} | ||
|
||
/** | ||
* @return int|null | ||
*/ | ||
public function getSize() | ||
{ | ||
return $this->get('size'); | ||
} | ||
|
||
/** | ||
* @param string|null $name | ||
* @return $this | ||
*/ | ||
public function setName($name) | ||
{ | ||
$this->set('name', $name); | ||
return $this; | ||
} | ||
|
||
/** | ||
* @param string $content | ||
* @return $this | ||
*/ | ||
public function setContent($content) | ||
{ | ||
$this->set('content', $content); | ||
return $this; | ||
} | ||
|
||
/** | ||
* @param string|null $mimeType | ||
* @return $this | ||
*/ | ||
public function setMimeType($mimeType) | ||
{ | ||
$this->set('mime_type', $mimeType); | ||
return $this; | ||
} | ||
|
||
/** | ||
* @param int|null $size | ||
* @return $this | ||
*/ | ||
public function setSize($size) | ||
{ | ||
$this->set('size', $size); | ||
return $this; | ||
} | ||
} |
70337bd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cute! I use a similar file representation.
Q: How do you ensure that the file content will not be distorted? Encode in base64? Raw bytes?