mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 12:33:56 +00:00
82 lines
1.6 KiB
PHP
82 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Documents\DataTransferObjects;
|
|
|
|
use App\Classes\General\Interfaces\DataTransferObject;
|
|
use App\Classes\Modules\Documents\Services\ConvertsBase64ToFile;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
class DocumentObject implements DataTransferObject
|
|
{
|
|
|
|
/** @var string */
|
|
private $document_type;
|
|
|
|
/** @var array */
|
|
private $files;
|
|
|
|
/** @var string */
|
|
private $reference;
|
|
|
|
/** @var int */
|
|
private $status;
|
|
|
|
/** @var string|null */
|
|
private $path;
|
|
|
|
/**
|
|
* DocumentObject constructor.
|
|
* @param string $document_type
|
|
* @param array $files
|
|
* @param string $reference
|
|
* @param int $status
|
|
* @param null|string $path
|
|
*/
|
|
public function __construct(string $document_type, array $files, string $reference, int $status, ?string $path = '')
|
|
{
|
|
$this->document_type = $document_type;
|
|
$this->files = $files;
|
|
$this->reference = $reference;
|
|
$this->status = $status;
|
|
$this->path = $path;
|
|
}
|
|
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getDocumentType(): string
|
|
{
|
|
return $this->document_type;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getReference(): string
|
|
{
|
|
return $this->reference;
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getStatus(): int
|
|
{
|
|
return $this->status;
|
|
}
|
|
|
|
|
|
/**
|
|
* @return array
|
|
* @throws \App\Classes\Exceptions\MalformedRequestException
|
|
*/
|
|
public function getFiles(): array
|
|
{
|
|
return (new ConvertsBase64ToFile($this->path))->convert($this->files);
|
|
}
|
|
|
|
|
|
|
|
}
|