forked from LiveCarta/yii2-aws-s3
initial commit
This commit is contained in:
35
src/base/commands/ExecutableCommand.php
Normal file
35
src/base/commands/ExecutableCommand.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace frostealth\yii2\aws\s3\base\commands;
|
||||
|
||||
use frostealth\yii2\aws\s3\interfaces\Bus;
|
||||
use frostealth\yii2\aws\s3\interfaces\commands\ExecutableCommand as ExecutableCommandInterface;
|
||||
|
||||
/**
|
||||
* Class ExecutableCommand
|
||||
*
|
||||
* @package frostealth\yii2\aws\s3\base\commands
|
||||
*/
|
||||
abstract class ExecutableCommand implements ExecutableCommandInterface
|
||||
{
|
||||
/** @var \frostealth\yii2\aws\s3\interfaces\Bus */
|
||||
private $bus;
|
||||
|
||||
/**
|
||||
* ExecutableCommand constructor.
|
||||
*
|
||||
* @param \frostealth\yii2\aws\s3\interfaces\Bus $bus
|
||||
*/
|
||||
public function __construct(Bus $bus)
|
||||
{
|
||||
$this->bus = $bus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
return $this->bus->execute($this);
|
||||
}
|
||||
}
|
||||
34
src/base/commands/traits/Async.php
Normal file
34
src/base/commands/traits/Async.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace frostealth\yii2\aws\s3\base\commands\traits;
|
||||
|
||||
/**
|
||||
* Trait Async
|
||||
*
|
||||
* @package frostealth\yii2\aws\s3\base\commands\traits
|
||||
*/
|
||||
trait Async
|
||||
{
|
||||
/** @var bool */
|
||||
private $isAsync = false;
|
||||
|
||||
/**
|
||||
* @param bool $async
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function async(bool $async = true)
|
||||
{
|
||||
$this->isAsync = $async;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
final public function isAsync(): bool
|
||||
{
|
||||
return $this->isAsync;
|
||||
}
|
||||
}
|
||||
47
src/base/commands/traits/Options.php
Normal file
47
src/base/commands/traits/Options.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace frostealth\yii2\aws\s3\base\commands\traits;
|
||||
|
||||
/**
|
||||
* Trait Options
|
||||
*
|
||||
* @package frostealth\yii2\aws\s3\base\commands\traits
|
||||
*/
|
||||
trait Options
|
||||
{
|
||||
/** @var array */
|
||||
protected $options = [];
|
||||
|
||||
/**
|
||||
* @param array $value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function setOptions(array $value)
|
||||
{
|
||||
$this->options = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
final public function getOptions(): array
|
||||
{
|
||||
return $this->options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function setOption(string $name, $value)
|
||||
{
|
||||
$this->options[$name] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user