phonebuster / equipmentprovider
包括结果对象和一些对象值在内的设备。
这个包的规范存储库似乎已经不存在,因此该包已被冻结。
v1.0.9
2016-11-02 10:48 UTC
Requires
- php: >=5.6
- zendframework/zend-servicemanager: 3.0.3
- zendframework/zend-validator: 2.6.*
Requires (Dev)
- phpunit/phpunit: 4.8
- zf2timo/phpunit-pretty-result-printer: @stable
This package is not auto-updated.
Last update: 2024-03-30 14:47:42 UTC
README
包括结果对象和一些对象值在内的设备将属于您。
这个项目的主要原因是什么?
- 首先,这个项目被创建是为了表示命令模式。这只是您的软件架构中的另一层。
如何使用命令?
创建新命令非常简单。编写一个自定义命令,并从 The AbstractCommand 扩展它。这实现了 CommandInterface。
例如
class ReadFileCollectionCommand extends AbstractCommand {
...
}
每个命令都实现了 execute 命令。这真的很棒。所有命令在必要时都会注入依赖项。之后,只需执行 execute 方法即可
例如
$readFileCollectionCommand = new ReadFileCollectionCommand($depencendies...);
$readFileCollectionCommand->execute($filePath, $fileName);
execute 方法接受可选的参数数量。重写 execute 方法以限制此参数并验证类型。
例如
public function execute(...$value)
{
//First parameter is the given count of arguments. Second the expected count of arguments
$this->checkNumberOfArguments(func_num_args(), 2);
//First parameter are an array of given arguments. Second is the type to validate parameters [0] => string, [1] => string
$this->checkParameters(func_get_args(), ['string', 'string'];
}