Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -3,7 +3,12 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Console;
|
namespace Console;
|
||||||
|
|
||||||
|
use ReflectionException;
|
||||||
use Snowflake\Abstracts\BaseObject;
|
use Snowflake\Abstracts\BaseObject;
|
||||||
|
use Snowflake\Abstracts\TraitApplication;
|
||||||
|
use Snowflake\Exception\ComponentException;
|
||||||
|
use Snowflake\Exception\NotFindClassException;
|
||||||
|
use Snowflake\Snowflake;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Command
|
* Class Command
|
||||||
@@ -12,6 +17,9 @@ use Snowflake\Abstracts\BaseObject;
|
|||||||
abstract class Command extends BaseObject implements CommandInterface
|
abstract class Command extends BaseObject implements CommandInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
|
use TraitApplication;
|
||||||
|
|
||||||
|
|
||||||
public string $command = '';
|
public string $command = '';
|
||||||
public string $description = '';
|
public string $description = '';
|
||||||
|
|
||||||
@@ -35,4 +43,44 @@ abstract class Command extends BaseObject implements CommandInterface
|
|||||||
return $this->description;
|
return $this->description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $name
|
||||||
|
* @return mixed
|
||||||
|
* @throws ComponentException
|
||||||
|
* @throws NotFindClassException
|
||||||
|
* @throws ReflectionException
|
||||||
|
*/
|
||||||
|
public function __get($name): mixed
|
||||||
|
{
|
||||||
|
if ($this->has($name)) {
|
||||||
|
return $this->get($name);
|
||||||
|
}
|
||||||
|
return parent::__get($name); // TODO: Change the autogenerated stub
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $name
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private function has($name): bool
|
||||||
|
{
|
||||||
|
return Snowflake::app()->has($name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $name
|
||||||
|
* @return mixed
|
||||||
|
* @throws ReflectionException
|
||||||
|
* @throws ComponentException
|
||||||
|
* @throws NotFindClassException
|
||||||
|
*/
|
||||||
|
private function get($name): mixed
|
||||||
|
{
|
||||||
|
return Snowflake::app()->get($name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user