From 9b80ffda10c39763a4bd00140466afde9606abf4 Mon Sep 17 00:00:00 2001 From: Vinicius Pugliesi Date: Wed, 31 Jan 2018 16:08:16 +0000 Subject: [PATCH] CurlFile posibility added in Request --- src/Http/Request.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/Http/Request.php b/src/Http/Request.php index 286caf5..2f0c960 100644 --- a/src/Http/Request.php +++ b/src/Http/Request.php @@ -5,6 +5,7 @@ use PrimeiraMao\Contracts\Http\Request as RequestContract; use PrimeiraMao\Http\RequestBuilder; use PrimeiraMao\PrimeiraMao; +use CurlFile; /** * PrimeiraMao API @@ -73,6 +74,11 @@ class Request extends RequestBuilder implements RequestContract */ private $data = []; + /** + * @var array + */ + private $filedata = []; + /** * @var string */ @@ -168,4 +174,29 @@ public function getData() { return $this->data; } + + /** + * Set request file + * + * @param array $filedata + * @return $this + */ + public function setFileData(array $filedata) + { + $this->filedata = [ + 'Filedata' => new CurlFile($filedata['tmp_name'], $filedata['type'], $filedata['name']), + ]; + + return $this; + } + + /** + * Get request file + * + * @return array + */ + public function getFileData() : array + { + return $this->filedata; + } } \ No newline at end of file