modify plugin name
This commit is contained in:
@@ -1,26 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Kiri\Abstracts;
|
|
||||||
|
|
||||||
|
|
||||||
use Kiri\Core\Dtl;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface IListener
|
|
||||||
* @package Kiri\Abstracts
|
|
||||||
*/
|
|
||||||
interface IListener
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Dtl $dtl
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function execute(Dtl $dtl): mixed;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,111 +0,0 @@
|
|||||||
<?php
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Kiri\Abstracts;
|
|
||||||
|
|
||||||
|
|
||||||
use Exception;
|
|
||||||
|
|
||||||
class Input
|
|
||||||
{
|
|
||||||
|
|
||||||
private array $_argv = [];
|
|
||||||
|
|
||||||
|
|
||||||
private string $_command = '';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Input constructor.
|
|
||||||
* @param $argv
|
|
||||||
* @throws
|
|
||||||
*/
|
|
||||||
public function __construct($argv)
|
|
||||||
{
|
|
||||||
$this->_argv = $this->resolve($argv);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getCommandName(): string
|
|
||||||
{
|
|
||||||
return $this->_command;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $key
|
|
||||||
* @param null $default
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function get($key, $default = null): mixed
|
|
||||||
{
|
|
||||||
return $this->_argv[$key] ?? $default;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $key
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function exists($key): bool
|
|
||||||
{
|
|
||||||
return isset($this->_argv[$key]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $key
|
|
||||||
* @param $value
|
|
||||||
* @return $this
|
|
||||||
*/
|
|
||||||
public function set($key, $value): static
|
|
||||||
{
|
|
||||||
$this->_argv[$key] = $value;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return false|string
|
|
||||||
*/
|
|
||||||
public function toJson(): bool|string
|
|
||||||
{
|
|
||||||
return json_encode($this->_argv, JSON_UNESCAPED_UNICODE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $parameters
|
|
||||||
* @return array
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public function resolve($parameters): array
|
|
||||||
{
|
|
||||||
$arrays = [];
|
|
||||||
$parameters = array_slice($parameters, 1);
|
|
||||||
if (empty($parameters)) {
|
|
||||||
return $arrays;
|
|
||||||
}
|
|
||||||
$this->_command = array_shift($parameters);
|
|
||||||
foreach ($parameters as $parameter) {
|
|
||||||
$explode = explode('=', $parameter);
|
|
||||||
if (count($explode) < 2) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$arrays[array_shift($explode)] = current($explode);
|
|
||||||
}
|
|
||||||
return $arrays;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getCommand(): string
|
|
||||||
{
|
|
||||||
return $this->_command;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
<?php
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Kiri\Abstracts;
|
|
||||||
|
|
||||||
|
|
||||||
use Exception;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class Listener
|
|
||||||
* @package Kiri\Abstracts
|
|
||||||
* 监听的名称
|
|
||||||
*/
|
|
||||||
abstract class Listener extends Component implements IListener
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -6,7 +6,6 @@ namespace Kiri;
|
|||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Kiri\Abstracts\Config;
|
use Kiri\Abstracts\Config;
|
||||||
use Kiri\Abstracts\Input;
|
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|||||||
Reference in New Issue
Block a user