update:class增加when方法

This commit is contained in:
JaguarJack
2020-11-19 19:11:18 +08:00
parent 0dfe4fb5c6
commit 21c1df4f69
2 changed files with 24 additions and 5 deletions

View File

@@ -97,4 +97,21 @@ class Classes
return $this;
}
/**
* when
*
* @time 2020年11月19日
* @param $condition
* @param \Closure $closure
* @return $this
*/
public function when($condition, \Closure $closure)
{
if ($condition) {
$closure($this);
}
return $this;
}
}