update:class增加when方法
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user