for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace STS\StorageConnect;
use Illuminate\Database\Eloquent\Model;
use STS\StorageConnect\Contracts\UploadTarget;
class UploadRequest
{
/**
* @var string
*/
protected $sourcePath;
protected $destinationPath;
* @var Model
protected $target;
* UploadRequest constructor.
*
* @param mixed $source
* @param null $destinationPath
public function __construct($source, $destinationPath = null)
if($source instanceof Model && $source instanceof UploadTarget) {
$this->sourcePath = $source->upload_source_path;
$this->destinationPath = $destinationPath ?: $source->upload_destination_path;
$this->target = $source;
} else {
$this->sourcePath = $source;
$this->destinationPath = $destinationPath;
}
$this->destinationPath = str_start($this->destinationPath, "/");
if (starts_with($this->sourcePath, "s3://")) {
app('aws')->createClient('s3')->registerStreamWrapper();
* @return string
public function getSourcePath()
return $this->sourcePath;
public function getDestinationPath()
return $this->destinationPath;
* @return Model
public function getTarget()
return $this->target;