for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace nebula\runnable\target;
use Closure;
use nebula\runnable\target\RunnableTarget;
/**
* 可执行命令:文件类型
*
*/
class ClosureTarget extends RunnableTarget
{
* 对象
* @var Closure
protected $closure;
public function __construct(Closure $closure, array $parameter =[]) {
$this->closure = $closure;
$this->parameter = $parameter;
$this->name = 'Closure object()';
}
public function getRunnableTarget()
return $this->closure;
* 是否可执行
* @return boolean
public function isVaild():bool
return true;
* 执行代码
* @param array $args
* @return mixed
public function apply(array $parameter)
if (count($parameter) == 0) {
$parameter = $this->getParameter();
return forward_static_call_array($this->closure, $parameter);